Let the app crash when LiteRT initialization fails

This commit is contained in:
Pierre-Yves Nicolas
2025-09-04 17:30:50 +02:00
parent f2f88f750a
commit 27b2a80863

View File

@@ -59,9 +59,10 @@ class ImageSegmentationService(private val context: Context) {
numThreads = 2 numThreads = 2
} }
Interpreter(litertBuffer, options) Interpreter(litertBuffer, options)
} catch (e: Exception) { } catch (e: Error) {
// That should not happen: let the app crash so that we know about it
Log.e(TAG, "Failed to load LiteRT model: ${e.message}") Log.e(TAG, "Failed to load LiteRT model: ${e.message}")
null throw IllegalStateException("Failed to load LiteRT model", e)
} }
} }