aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/remote
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-05-05 22:47:26 +0200
committerRobert Jaros <rjaros@finn.pl>2018-05-05 22:47:26 +0200
commit82d9528999273b75df1542c2effa764a762b10dd (patch)
tree132493aeda7c30a04e2ada4e7594cc20ed8c07e7 /src/main/kotlin/pl/treksoft/kvision/remote
parent0c35c53941811f5e574fbdd9187cde97b0486002 (diff)
downloadkvision-82d9528999273b75df1542c2effa764a762b10dd.tar.gz
kvision-82d9528999273b75df1542c2effa764a762b10dd.tar.bz2
kvision-82d9528999273b75df1542c2effa764a762b10dd.zip
Style fixes.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/remote')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt b/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
index 2f85a51f..7d9f4b05 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
@@ -59,14 +59,11 @@ open class CallAgent {
this.method = method.name
this.success =
{ data: dynamic, _: Any, _: Any ->
- if (data.id != jsonRpcRequest.id) {
- reject(Exception("Invalid response ID"))
- } else if (data.error != null) {
- reject(Exception(data.error.toString()))
- } else if (data.result != null) {
- resolve(data.result)
- } else {
- reject(Exception("Invalid response"))
+ when {
+ data.id != jsonRpcRequest.id -> reject(Exception("Invalid response ID"))
+ data.error != null -> reject(Exception(data.error.toString()))
+ data.result != null -> resolve(data.result)
+ else -> reject(Exception("Invalid response"))
}
}
this.error =