From 61649cb1b34771b3f7d9ae996040dec32c4a01c6 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Tue, 19 Mar 2019 16:37:18 +0100 Subject: Better error handling in CallAgent --- .../src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'kvision-modules/kvision-remote') 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 eb88ba8b..1a9460f2 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 @@ -86,6 +86,8 @@ open class CallAgent { { xhr: JQueryXHR, _: String, errorText: String -> val message = if (xhr.responseJSON != null && xhr.responseJSON != undefined) { xhr.responseJSON.toString() + } else if (xhr.responseText != undefined) { + xhr.responseText } else { errorText } @@ -130,6 +132,8 @@ open class CallAgent { { xhr: JQueryXHR, _: String, errorText: String -> val message = if (xhr.responseJSON != null && xhr.responseJSON != undefined) { NativeJSON.stringify(xhr.responseJSON) + } else if (xhr.responseText != undefined) { + xhr.responseText } else { errorText } -- cgit