diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-11-01 17:44:31 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-11-01 17:44:31 +0100 |
commit | 5763aa3b0004b678d7791b32e1a92b6facb9b17e (patch) | |
tree | 3bd6ca99f2f2dbec9e196ca63215c7ba4bce6603 /kvision-modules/kvision-server-spring-boot/src/main/kotlin | |
parent | c4a43b9c8ce6db65784e9bcb7073dcf6c4a6cd41 (diff) | |
download | kvision-5763aa3b0004b678d7791b32e1a92b6facb9b17e.tar.gz kvision-5763aa3b0004b678d7791b32e1a92b6facb9b17e.tar.bz2 kvision-5763aa3b0004b678d7791b32e1a92b6facb9b17e.zip |
Better exception handling in server-side interfaces.
Diffstat (limited to 'kvision-modules/kvision-server-spring-boot/src/main/kotlin')
-rw-r--r-- | kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index fb6b6210..17451461 100644 --- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -146,12 +146,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) @@ -190,12 +191,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) @@ -245,12 +247,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) @@ -302,12 +305,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) @@ -360,12 +364,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) @@ -420,12 +425,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) @@ -530,12 +536,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) @@ -584,12 +591,13 @@ 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) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( id = jsonRpcRequest.id, - error = e.message ?: "Error" + error = e.message ?: "Error", + exceptionType = e.javaClass.canonicalName ) ) ) |