aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-remote
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-remote')
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt8
1 files changed, 7 insertions, 1 deletions
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
index 64c257cd..0a56465d 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
@@ -71,7 +71,13 @@ open class CallAgent {
{ data: dynamic, _: Any, _: Any ->
when {
data.id != jsonRpcRequest.id -> reject(Exception("Invalid response ID"))
- data.error != null -> reject(Exception(data.error.toString()))
+ data.error != null -> {
+ if (data.exceptionType == "pl.treksoft.kvision.remote.ServiceException") {
+ reject(ServiceException(data.error.toString()))
+ } else {
+ reject(Exception(data.error.toString()))
+ }
+ }
data.result != null -> resolve(data.result)
else -> reject(Exception("Invalid response"))
}