From 82d9528999273b75df1542c2effa764a762b10dd Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 5 May 2018 22:47:26 +0200 Subject: Style fixes. --- src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/remote') 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 = -- cgit