💠Only works if the error is raised in the OData Service via/IWBEP/CX_MGW_BUSI_EXCEPTION
or/IWBEP/CX_MGW_TECH_EXCEPTION
/** * Shows a {@link sap.m.MessageBox} when a service call has failed. * Only the first error message will be display. * @param {string} sDetails a technical error to be displayed on request * @private */ _showServiceError: function(sDetails) { if (this._bMessageOpen) { return; } this._bMessageOpen = true; MessageBox.error( this.tryToResolveError(sDetails), { id: "serviceErrorMessageBox", details: sDetails, styleClass: this._oComponent.getContentDensityClass(), actions: [MessageBox.Action.CLOSE], onClose: function() { this._bMessageOpen = false; }.bind(this) } ); }, /** * @description try to read the error message value * @param {string} sDetails a technical error to be displayed on request * @returns {string} sDetails */ tryToResolveError: function(sDetails) { var sErrorText; try { var oError = JSON.parse(sDetails.responseText); sErrorText = oError.error.message.value; } catch (oException) { sErrorText = this._sErrorText; } finally { return sErrorText; } }