Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.ionic.plugin.android.capacitor.core.WrapperDelegate
import com.ionic.plugin.android.capacitor.core.toJSObject
import com.ionic.plugin.android.core.actions.CallContext
import com.ionic.plugin.core.PluginException
import com.ionic.plugin.core.PluginExceptionBase
import com.ionic.plugin.core.actions.Mappers
import com.spryrocks.kson.JsonArray
import com.spryrocks.kson.JsonObject
Expand Down Expand Up @@ -68,16 +67,12 @@ class CallContext(
}

override fun error(error: Throwable?, finish: Boolean) {
val exception: Exception? = when (error) {
is Exception -> error
is Throwable -> Exception(error)
else -> null
}
val exception = error?.let(mappers.errorMapper::map)

val defaultMessage = "Unknown error"

val message = exception?.message ?: defaultMessage
val data = (exception as? PluginExceptionBase)?.let(mappers.errorMapper::mapToJson)
val data = exception?.let(mappers.errorMapper::mapToJson)

reject(finish, message, data)
}
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spryrocks/capacitor-ionic-core-plugin",
"version": "5.9.0-alpha.1",
"version": "5.9.1-alpha.0",
"description": "Ionic plugin core capacitor",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -35,7 +35,7 @@
"@capacitor/core": "^5.4.0",
"@spryrocks/eslint-config": "^0.3.0-alpha.1",
"rimraf": "^5.0.1",
"rollup": "^3.29.2",
"rollup": "^3.29.5",
"typescript": "^5.4.5"
},
"publishConfig": {
Expand All @@ -48,5 +48,6 @@
"ios": {
"src": "ios"
}
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}