File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
android/src/main/java/com/ionic/plugin/android/capacitor/core/actions Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import com.ionic.plugin.android.capacitor.core.WrapperDelegate
55import com.ionic.plugin.android.capacitor.core.toJSObject
66import com.ionic.plugin.android.core.actions.CallContext
77import com.ionic.plugin.core.PluginException
8- import com.ionic.plugin.core.PluginExceptionBase
98import com.ionic.plugin.core.actions.Mappers
109import com.spryrocks.kson.JsonArray
1110import com.spryrocks.kson.JsonObject
@@ -68,16 +67,12 @@ class CallContext(
6867 }
6968
7069 override fun error (error : Throwable ? , finish : Boolean ) {
71- val exception: Exception ? = when (error) {
72- is Exception -> error
73- is Throwable -> Exception (error)
74- else -> null
75- }
70+ val exception = error?.let (mappers.errorMapper::map)
7671
7772 val defaultMessage = " Unknown error"
7873
7974 val message = exception?.message ? : defaultMessage
80- val data = ( exception as ? PluginExceptionBase ) ?.let (mappers.errorMapper::mapToJson)
75+ val data = exception?.let (mappers.errorMapper::mapToJson)
8176
8277 reject(finish, message, data)
8378 }
You can’t perform that action at this time.
0 commit comments