/**
* Extract errors from a backend message class.
* @param {object} sDetails a technical error
* @return a either messages from the backend message class or return the initial error object
* @function
* @private
*/
_extractError: function(sDetails) {
if (sDetails.responseText) {
var parsedJSError = null;
try {
parsedJSError = jQuery.sap.parseJS(sDetails.responseText);
} catch (err) {
return sDetails;
}
if (parsedJSError && parsedJSError.error && parsedJSError.error.code) {
var strError = "";
//check if the error is from our backend error class
if (parsedJSError.error.code.split("/")[0] === "MY_MSG_CLASS") {
var array = parsedJSError.error.innererror.errordetails;
for (var i = 0; i < array.length; i++) {
strError += String.fromCharCode("8226") + " " + array[i].message + "\n";
}
} else {
//if there is no message class found
return sDetails;
}
return strError;
}
}
return sDetails;
},
_showServiceError: function(sDetails) {
if (this._bMessageOpen) {
return;
}
this._bMessageOpen = true;
MessageBox.error(
this._sErrorText, {
id: "serviceErrorMessageBox",
details: this._extractError(sDetails),
styleClass: this._oComponent.getContentDensityClass(),
actions: [MessageBox.Action.CLOSE],
onClose: function() {
this._bMessageOpen = false;
}.bind(this)
}
);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
43 | |
25 | |
17 | |
15 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 |