-
Notifications
You must be signed in to change notification settings - Fork 237
Open
Description
Wrapping this code in a try/catch means any descriptive error message will be invisible to the developer. Instead, the library just returns an opaque false which is not useful for troubleshooting:
cactus/kotlin/library/src/androidMain/kotlin/CactusLM.android.kt
Lines 18 to 34 in 087aee1
| try { | |
| val modelsDir = File(applicationContext.cacheDir, "models") | |
| if (!modelsDir.exists()) modelsDir.mkdirs() | |
| val modelFile = File(modelsDir, filename) | |
| if (modelFile.exists()) return@withContext true | |
| val urlConnection = URL(url).openConnection() | |
| urlConnection.getInputStream().use { input -> | |
| modelFile.outputStream().use { output -> | |
| input.copyTo(output) | |
| } | |
| } | |
| modelFile.exists() | |
| } catch (e: Exception) { | |
| false | |
| } |
Metadata
Metadata
Assignees
Labels
No labels