Skip to content

Commit

Permalink
Small improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
milos85vasic committed Dec 23, 2023
1 parent 53ac2ef commit e776043
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.google.gson.GsonBuilder
import com.redelf.commons.BuildConfig
import com.redelf.commons.R
import com.redelf.commons.execution.Executor
import com.redelf.commons.management.DataManagement
import com.redelf.commons.management.Management
import com.redelf.commons.persistance.Data
import com.redelf.commons.persistance.GsonParser
Expand All @@ -28,12 +29,12 @@ abstract class BaseApplication : Application() {
lateinit var CONTEXT: Context
}

val managers = mutableListOf<DataManagement<*>>()

protected abstract fun onDoCreate()
protected abstract fun takeSalt(): String

protected open fun populateManagers() = listOf<Management>()

private val managers = mutableListOf<Management>()
protected open fun populateManagers() = listOf<DataManagement<*>>()

private val screenReceiver: BroadcastReceiver = object : BroadcastReceiver() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
package com.redelf.commons.exception

import android.text.TextUtils
import com.redelf.commons.recordException

class UnknownException private constructor() : IllegalStateException("Something went wrong") {
class UnknownException
private constructor(reason: String = "") : IllegalStateException(getMessage(reason)) {
companion object {

fun throwIt() : UnknownException {
private fun getMessage(reason: String = "") : String {

val exception = UnknownException()
val msg = "Something went wrong"

if (!TextUtils.isEmpty(reason)) {

return "$msg, reason: $reason"
}
return msg
}

fun throwIt(reason: String = "") : UnknownException {

val exception = UnknownException(reason)
recordException(exception)
throw exception
}
Expand Down

0 comments on commit e776043

Please sign in to comment.