cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle 502 proxy error in the sap ui5

former_member338801
Participant
0 Kudos
530

Hi Experts,

How to handle 502 proxy error. It comes when oData service call happens for validation purpose. Please check my sap ui5 code if this can be handled in some or other way by putting try catch blocks. When 404 error comes then message pop up comes with the error using below code.

var errmessage = JSON.parse(oError.responseText);

errmessage.error.message.value

onclick: function () {
   lv_BusyDialog.open();
   var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
   var para1= " ";
   var para2= " ";
   var para3 = ' ';
   var url = "/sap/opu/odata/sap/Test_SRV/";
   var allfilters = [new sap.ui.model.Filter({
     path: "ZZ_para1",
     operator: sap.ui.model.FilterOperator.EQ,
     value1: para1}),
    new sap.ui.model.Filter({
     path: "ZZ_para2",
     operator: sap.ui.model.FilterOperator.EQ,
     value1: para2
    }),
    new sap.ui.model.Filter({
     path: "ZZ_para3",
     operator: sap.ui.model.FilterOperator.GE,
     value1: para3
    })
   ];
   var oModel = new sap.ui.model.odata.v2.ODataModel(url);
   sap.ui.getCore().setModel(oModel);
   /   oModel.metadataLoaded().then(function (oSuccess) {
    oModel.read("/TestSet", {
     filters: allfilters,
     success: function (oData, oResponse) {
      oRouter.navTo("view2");
      lv_BusyDialog.close();
     },
     error: function (oError) {
      lv_BusyDialog.close();
      var errmessage = JSON.parse(oError.responseText);
      MessageBox.show(
       errmessage.error.message.value, {
        icon: MessageBox.Icon.ERROR,
        title: "Sever Error",
        actions: [MessageBox.Action.OK],
        onClose: function (oAction) {
         if (oAction === MessageBox.Action.OK) {
         }
        }
       }
      );
     }
    });
   }, function (oError) {
   });
  },
  
former_member338801
Participant
0 Kudos

..........

Accepted Solutions (0)

Answers (0)