cancel
Showing results for 
Search instead for 
Did you mean: 

How to catch the error if oDataModel binding done from XML view fails?

Hello Experts,

I'm unable to figure out on how to display error message if there is a failure in oData Binding.

I know that we have methods ( error() and success() ) that we could use if we call the oData from the controller succeeds or fails. But how to display the error message to the user if the oData call from the XML view fails?

I'm using the following code in my XML View:

<Select items="{path: '/profileDetSet'}">
<core:Item key="{Profile}" text="{Description}"/>
</Select>

I've more than one Select and a table too in my View. How can we catch the error if the Binding fails for some reason from the backend?

Thanks & Regards,
Soundarya

Accepted Solutions (0)

Answers (2)

Answers (2)

Nahed
Explorer
0 Kudos

Hi Soundarya,

did you get a solution for your issue?

Thanks

Nahed

former_member227918
Active Contributor
0 Kudos

you can try attaching below two events of your model where you are defining the model in your app,

attachRequestFailed or attachMetadataFailed as below,

oModel.attachRequestFailed(function(oEvent) {
  // using oEvent.getParameters() you can get error details
}, this);
oModel.attachMetadataFailed(function(oEvent) {
   // using oEvent.getParameters() you can get error details
}, this);

this will trigger if any request or metadata fails respectively.