Correctly propagate frontend call warnings (fixes #211)
Change-Id: Ia571b8e6b0ba0a4edbf0501254ce2bc115f18cf6
diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index 80391d8..3b3b821 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -169,10 +169,16 @@
return;
};
- if (retJSObj !== undefined && retJSObj["errors"] !== undefined) {
- retJSObj["errors"].forEach(
- e => KorAP.log(e[0], e[1] || "Unknown")
- );
+ if (retJSObj !== undefined) {
+ if (retJSObj["errors"] !== undefined) {
+ retJSObj["errors"].forEach(
+ e => KorAP.log(e[0], e[1] || "Unknown")
+ );
+ } else if (retJSObj["warnings"] !== undefined) {
+ retJSObj["warnings"].forEach(
+ e => KorAP.log(e[0], e[1] || "Unknown", null, 'warn')
+ );
+ }
}
else if (this.status !== 200) {