Skip to content

Commit 409413a

Browse files
committed
Use throwable to catch initContext exception
1 parent 2b55b1d commit 409413a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

shared/src/androidMain/kotlin/com/module/notelycompose/platform/Transcriper.android.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ actual class Transcriber(
7070
val modelFile = File(modelsPath, modelFileName)
7171
whisperContext = WhisperContext.createContextFromFile(modelFile.absolutePath)
7272
canTranscribe = true
73-
} catch (e:RuntimeException){
73+
} catch (e: OutOfMemoryError) {
7474
e.printStackTrace()
75-
} catch (e:Exception){
75+
} catch (e: Throwable) {
7676
e.printStackTrace()
7777
}
7878
}
@@ -83,11 +83,11 @@ actual class Transcriber(
8383
}
8484

8585
actual fun isValidModel(modelFileName: String) : Boolean{
86-
try {
87-
loadBaseModel(modelFileName)
88-
}catch (e:Exception){
86+
try {
87+
loadBaseModel(modelFileName)
88+
} catch (e:Exception){
8989
return false
90-
}
90+
}
9191
return true
9292
}
9393

0 commit comments

Comments
 (0)