@azrico/webobject 1.4.88 → 1.4.89

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.
@@ -191,7 +191,7 @@ export declare class SimpleObject extends MapableObject {
191
191
  * and its type
192
192
  * @param toObj
193
193
  */
194
- setSaveResult(toObj: any, type?: saveResultType | "auto"): void;
194
+ setSaveResult(toObj: any, type?: saveResultType | "auto", registerErrors?: boolean): void;
195
195
  getSaveResult(original?: boolean): any;
196
196
  getSaveResultType(): saveResultType;
197
197
  static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<void>;
@@ -865,12 +865,17 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
865
865
  */
866
866
  function setSaveResult(toObj) {
867
867
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "auto";
868
+ var registerErrors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
868
869
  _classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, toObj);
869
870
  //check if the given object is a valid save result
870
871
  if (type === "error") this.__saveResultIsSuccess = false;else this.__saveResultIsSuccess = Boolean(type === "nothing" || this.constructor["isResultValid"](toObj));
871
872
  if (type === "auto") {
872
873
  type = this.__saveResultIsSuccess ? "normal" : "error";
873
874
  }
875
+ if (registerErrors && !this.__saveResultIsSuccess) {
876
+ console.error("bad save result : ", this.__saveResultObject);
877
+ SimpleObject.addError(this, "save result is not valid", "the response from server was not valid", true);
878
+ }
874
879
  this.__saveResultType = type;
875
880
  }
876
881
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.88",
3
+ "version": "1.4.89",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",