@azrico/webobject 1.5.34 → 1.5.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1204,8 +1204,10 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1204
1204
|
type = this.__saveResultIsSuccess ? "normal" : "error";
|
|
1205
1205
|
}
|
|
1206
1206
|
if (registerErrors && !this.__saveResultIsSuccess) {
|
|
1207
|
-
|
|
1208
|
-
|
|
1207
|
+
var sr = this.__saveResultObject;
|
|
1208
|
+
var errorString = sr == null ? "" : sr instanceof Error ? sr.message : JSON.stringify(sr);
|
|
1209
|
+
console.error("bad save result : ", sr);
|
|
1210
|
+
SimpleObject.addError(this, "save result is not valid", errorString, true);
|
|
1209
1211
|
}
|
|
1210
1212
|
this.__saveResultType = type;
|
|
1211
1213
|
return type;
|
|
@@ -1474,14 +1476,11 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1474
1476
|
var sub = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1475
1477
|
if ((0, _object.object_isEmpty)(result_object)) return false;
|
|
1476
1478
|
switch (_typeof(result_object)) {
|
|
1477
|
-
case "
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
return this.isResultValid(result_object);
|
|
1481
|
-
} catch (_unused) {
|
|
1479
|
+
case "object":
|
|
1480
|
+
/* ----------------------------- result is error ---------------------------- */
|
|
1481
|
+
if (result_object instanceof Error) {
|
|
1482
1482
|
return false;
|
|
1483
1483
|
}
|
|
1484
|
-
case "object":
|
|
1485
1484
|
/* --------- maybe website sends the result as array with 1 element --------- */
|
|
1486
1485
|
if (Array.isArray(result_object)) {
|
|
1487
1486
|
if (sub) return false; //avoid going too deep
|
|
@@ -1495,6 +1494,13 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1495
1494
|
return (0, _object.object_equals)(result_object.expected, result_object.result);
|
|
1496
1495
|
}
|
|
1497
1496
|
return !(0, _string.string_isEmpty)(this.getID(result_object));
|
|
1497
|
+
case "string":
|
|
1498
|
+
try {
|
|
1499
|
+
result_object = JSON.parse(result_object);
|
|
1500
|
+
return this.isResultValid(result_object);
|
|
1501
|
+
} catch (_unused) {
|
|
1502
|
+
return false;
|
|
1503
|
+
}
|
|
1498
1504
|
case "number":
|
|
1499
1505
|
return result_object > 0;
|
|
1500
1506
|
case "boolean":
|