[mob] Catch unexpected error in custom plugin
This commit is contained in:
@@ -197,6 +197,11 @@ class OnnxDartPlugin: FlutterPlugin, MethodCallHandler {
|
||||
withContext(Dispatchers.Main) {
|
||||
result.error("PREDICTION_ERROR", "Error during prediction: ${e.message}", null)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error during prediction: ${e.message}", e)
|
||||
withContext(Dispatchers.Main) {
|
||||
result.error("UNHANDLED_ERROR", "Error during prediction: ${e.message}", null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user