File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
components/service/firefox-accounts/src/main/java/mozilla/components/service/fxa Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -52,16 +52,21 @@ abstract class RustObject<T> : Closeable {
52
52
}
53
53
}
54
54
55
+ @Suppress(" TooGenericExceptionCaught" )
55
56
fun <U > safeAsync (callback : (Error .ByReference ) -> U ): FxaResult <U > {
56
57
val result = FxaResult <U >()
57
58
val e = Error .ByReference ()
58
59
launch {
59
60
synchronized(FxaClient .INSTANCE ) {
60
- val ret = callback(e)
61
- if (e.isFailure()) {
62
- result.completeExceptionally(FxaException .fromConsuming(e))
63
- } else {
64
- result.complete(ret)
61
+ try {
62
+ val ret = callback(e)
63
+ if (e.isFailure()) {
64
+ result.completeExceptionally(FxaException .fromConsuming(e))
65
+ } else {
66
+ result.complete(ret)
67
+ }
68
+ } catch (e: Exception ) {
69
+ result.completeExceptionally(e)
65
70
}
66
71
}
67
72
}
You can’t perform that action at this time.
0 commit comments