aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-ktor/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-11-01 17:44:31 +0100
committerRobert Jaros <rjaros@finn.pl>2019-11-01 17:44:31 +0100
commit5763aa3b0004b678d7791b32e1a92b6facb9b17e (patch)
tree3bd6ca99f2f2dbec9e196ca63215c7ba4bce6603 /kvision-modules/kvision-server-ktor/src/main
parentc4a43b9c8ce6db65784e9bcb7073dcf6c4a6cd41 (diff)
downloadkvision-5763aa3b0004b678d7791b32e1a92b6facb9b17e.tar.gz
kvision-5763aa3b0004b678d7791b32e1a92b6facb9b17e.tar.bz2
kvision-5763aa3b0004b678d7791b32e1a92b6facb9b17e.zip
Better exception handling in server-side interfaces.
Diffstat (limited to 'kvision-modules/kvision-server-ktor/src/main')
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt40
1 files changed, 24 insertions, 16 deletions
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index e4a48bc3..62ce4f0c 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -124,11 +124,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}
@@ -163,11 +164,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}
@@ -211,11 +213,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}
@@ -261,11 +264,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}
@@ -312,11 +316,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}
@@ -365,11 +370,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}
@@ -464,11 +470,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}
@@ -511,11 +518,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
)
} catch (e: Exception) {
- LOG.error(e.message, e)
+ if (!(e is ServiceException)) LOG.error(e.message, e)
call.respond(
JsonRpcResponse(
id = jsonRpcRequest.id,
- error = e.message ?: "Error"
+ error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
)
)
}