aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-03-19 16:37:18 +0100
committerRobert Jaros <rjaros@finn.pl>2019-03-19 16:37:18 +0100
commit61649cb1b34771b3f7d9ae996040dec32c4a01c6 (patch)
tree7925f143ec978b97d433ecf1af238ea31b481c86 /kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft
parent11b9c93cbcdb35ce6b5c0827ccbe58fd36959b9e (diff)
downloadkvision-61649cb1b34771b3f7d9ae996040dec32c4a01c6.tar.gz
kvision-61649cb1b34771b3f7d9ae996040dec32c4a01c6.tar.bz2
kvision-61649cb1b34771b3f7d9ae996040dec32c4a01c6.zip
Better error handling in CallAgent
Diffstat (limited to 'kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft')
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt4
1 files changed, 4 insertions, 0 deletions
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
}