Skip to content
Snippets Groups Projects
Commit 317dfd7a authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Get ML exception

(cherry picked from commit 08b19037)
parent e366a134
No related branches found
No related tags found
No related merge requests found
......@@ -82,6 +82,10 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
private var discoverTriggered = false
internal val sb = StringBuilder()
val exceptionHandler = AbstractMedialibrary.MedialibraryExceptionHandler { context, errMsg ->
Log.d(TAG, "Exception occured, $context: $errMsg")
}
private val notificationActor by lazy {
actor<Notification>(capacity = Channel.UNLIMITED) {
for (update in channel) when (update) {
......@@ -400,6 +404,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
val context = this@MediaParsingService
var shouldInit = !dbExists()
val initCode = medialibrary.init(context)
medialibrary.exceptionHandler = exceptionHandler
shouldInit = shouldInit or (initCode == AbstractMedialibrary.ML_INIT_DB_RESET) or (initCode == AbstractMedialibrary.ML_INIT_DB_CORRUPTED)
if (initCode != AbstractMedialibrary.ML_INIT_FAILED) initMedialib(action.parse, context, shouldInit, action.upgrade)
else exitCommand()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment