Skip to content

Commit b7dd30e

Browse files
committed
Added error lambda
1 parent a93fd6b commit b7dd30e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

JetPDFVue/src/main/java/com/pratikk/jetpdfvue/state/VueFilePicker.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ class VueFilePicker {
127127
@Composable
128128
fun getLauncher(
129129
interceptResult: suspend (File) -> Unit = {},
130-
onResult: (File) -> Unit = {}
130+
onResult: (File) -> Unit = {},
131+
onError:(Exception) -> Unit = {}
131132
): ManagedActivityResultLauncher<Intent, ActivityResult> {
132133
val context = LocalContext.current
133134
LaunchedEffect(key1 = vueFilePickerState, block = {
@@ -154,7 +155,8 @@ class VueFilePicker {
154155
}
155156
} catch (e: CancellationException) {
156157
throw e
157-
} catch (_: Exception) {
158+
} catch (e: Exception) {
159+
onError(e)
158160
null
159161
}
160162
file?.let {

0 commit comments

Comments
 (0)