[Android] Get ML exception

Geoffrey Métais git at videolan.org
Thu Oct 3 10:08:48 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct  2 10:56:05 2019 +0200| [08b190373903c80db9987a6dc256ae11439dc0d9] | committer: Geoffrey Métais

Get ML exception

> https://code.videolan.org/videolan/vlc-android/commit/08b190373903c80db9987a6dc256ae11439dc0d9
---

 vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index ded84faaa..c5c42e316 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -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 at 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()



More information about the Android mailing list