jsf.js_next_gen 1.0.0-beta-7 → 1.0.0-beta-10

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.
@@ -611,7 +611,7 @@ var Implementation;
611
611
  *
612
612
  *
613
613
  * handles the errors, in case of an onError exists within the context the onError is called as local error handler
614
- * the registered error handlers in the queue receiv an error message to be dealt with
614
+ * the registered error handlers in the queue received an error message to be dealt with
615
615
  * and if the projectStage is at development an alert box is displayed
616
616
  *
617
617
  * note: we have additional functionality here, via the global config myfaces.config.defaultErrorOutput a function can be provided
@@ -1859,7 +1859,7 @@ var ExtLang;
1859
1859
  templateParams[_i - 2] = arguments[_i];
1860
1860
  }
1861
1861
  installedLocale = installedLocale !== null && installedLocale !== void 0 ? installedLocale : new Messages_1.Messages();
1862
- var msg = (_b = (_a = installedLocale[key]) !== null && _a !== void 0 ? _a : defaultMessage) !== null && _b !== void 0 ? _b : key + " - undefined message";
1862
+ var msg = (_b = (_a = installedLocale[key]) !== null && _a !== void 0 ? _a : defaultMessage) !== null && _b !== void 0 ? _b : key;
1863
1863
  mona_dish_1.Stream.of.apply(mona_dish_1.Stream, templateParams).each(function (param, cnt) {
1864
1864
  msg = msg.replace(new RegExp(["\\{", cnt, "\\}"].join(Const_1.EMPTY_STR), "g"), param);
1865
1865
  });
@@ -2679,14 +2679,22 @@ var ResponseProcessor = /** @class */ (function () {
2679
2679
  */
2680
2680
  var mergedErrorData = new mona_dish_1.Config({});
2681
2681
  mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.P_PARTIAL_SOURCE).get(0).value;
2682
- mergedErrorData.assign(Const_1.ERROR_NAME).value = node.getIf(Const_1.ERROR_NAME).textContent(Const_1.EMPTY_STR);
2683
- mergedErrorData.assign(Const_1.ERROR_MESSAGE).value = node.getIf(Const_1.ERROR_MESSAGE).cDATAAsString;
2682
+ mergedErrorData.assign(Const_1.ERROR_NAME).value = node.querySelectorAll(Const_1.ERROR_NAME).textContent(Const_1.EMPTY_STR);
2683
+ mergedErrorData.assign(Const_1.ERROR_MESSAGE).value = node.querySelectorAll(Const_1.ERROR_MESSAGE).cDATAAsString;
2684
2684
  var hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
2685
+ //we now store the response xml also in the error data for further details
2685
2686
  mergedErrorData.assignIf(hasResponseXML, Const_1.RESPONSE_XML).value = this.internalContext.getIf(Const_1.RESPONSE_XML).value.get(0).value;
2687
+ // error post processing and enrichment (standard messages from keys)
2686
2688
  var errorData = ErrorData_1.ErrorData.fromServerError(mergedErrorData);
2687
- this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
2689
+ // we now trigger an internally stored onError function which might be a attached to the context
2690
+ // either we haven an internal on error, or an on error has been bassed via params from the outside
2691
+ // in both cases they are attached to our contexts
2692
+ this.triggerOnError(errorData);
2688
2693
  AjaxImpl_1.Implementation.sendError(errorData);
2689
2694
  };
2695
+ ResponseProcessor.prototype.triggerOnError = function (errorData) {
2696
+ this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
2697
+ };
2690
2698
  /**
2691
2699
  * process the redirect operation
2692
2700
  *
@@ -3342,6 +3350,9 @@ var XhrRequest = /** @class */ (function () {
3342
3350
  xhrObject.open(this.ajaxType, (0, RequestDataResolver_1.resolveFinalUrl)(this.sourceForm, formData, this.ajaxType), true);
3343
3351
  //adding timeout
3344
3352
  this.timeout ? xhrObject.timeout = this.timeout : null;
3353
+ xhrObject.onerror = function (data) {
3354
+ _this.handleError(new Error("XHR Error: ".concat(JSON.stringify(data))));
3355
+ };
3345
3356
  //a bug in the xhr stub library prevents the setRequestHeader to be properly executed on fake xhr objects
3346
3357
  //normal browsers should resolve this
3347
3358
  //tests can quietly fail on this one