openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

sap.ui.model.odata.ODataModel :: attachMetadataFailed

Open luciencooper opened this issue 11 years ago • 4 comments

Is there a way to access the XML response for error logging purposes?

Is anything passed to the callback function?

I tried this:

model.attachMetadataFailed(function (mArguments) {
    alert(mArguments.message + "\n" +
          mArguments.statusCode + "\n" +
          mArguments.statusText + "\n" +
          mArguments.responseText);
});

All were undefined unfortunately, maybe I'm doing something wrong - not much in the api docs about this.

Also having issues with the event being fired multiple times. Still investigating my own code though to be sure of what's happening.

luciencooper avatar Feb 18 '15 12:02 luciencooper

Hello Lucien,

thanks for reporting this, however i think it is not an issue in OpenUI5. Please use our StackOverflow community for discussions on OpenUi5: stackoverflow.com/questions/tagged/sapui5

But since you already opened this ticket here, let me quickly reply: The first parameters passed in to the callback/eventHandler function is a UI5 event and you can get the parameters for all UI5 events with the following call: arguments[0].getParameters() It will return an object with the parameters "message", "request", and "response" Object {message: "Failed to execute 'send' on 'XMLHttpRequest': Fail…org/V3/Northwind/Northwind.svc/Orders/$metadata'.", request: undefined, response: undefined}message: "Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://services.odata.org/V3/Northwind/Northwind.svc/Orders/$metadata'."request: undefinedresponse: undefined__proto__: Object

This should be enough for logging the reason, right?

Let me know if this helps!

Cheers,

Michael

Michadelic avatar Feb 20 '15 12:02 Michadelic

PS: you can try out this jsbin to test it: http://jsbin.com/keceziyosa/1/edit

Michadelic avatar Feb 20 '15 12:02 Michadelic

Great, thanks. I'm guessing this isn't mentioned anywhere here - https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.html

Also, it seemed to work with arguments.getParameters(); instead.

But yes, this is very useful information! Will try and keep these sort of issues within StackOverflow in future.

luciencooper avatar Feb 20 '15 13:02 luciencooper

Hello Lucien,

it is the standard way of eventing in UI5, but it isn't explained in detail how to access the odata stuff in this case. I asked the dev who implemented this feature to be more verbose on this topic in the API documentation.

Cheers, Michael

Michadelic avatar Feb 20 '15 16:02 Michadelic