question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ODataModel function metadataLoaded returns promise which doesn't react on the request response if failed

See original GitHub issue

SAPUI5 1.38.18

this code doesn’t react on the XHR response:

	this.getModel().metadataLoaded().then(
				function(oSuccess) {
					// do nothing
				},
				function(oError) {
					
				});

I also tried catch - never worked.

Yes - I agree I can use metadataFailed event. However I don’t understand then why do we need this method if it returns the promise working only on a half.

Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
goligocommented, Apr 6, 2017

This is by design, the metadataLoaded promise does never fail, as described in the API documentation: “The promise won’t get rejected in case the metadata loading failed but is only resolved if the metadata is loaded successfully.”.

This is done this way to enable the possibility to retry loading the metadata and have it resolved later on.

0reactions
ThePlenkovcommented, Jun 19, 2020

thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the replacement for "metadataLoaded" in JSONModel?
Since 1.64 1, JSONModel returns a promise when loadData or dataLoaded is ... metadataLoaded() 2 , the promise here actually rejects if the...
Read more >
ODataModel: catch error when metadata failed
Hello, When an OData model is declared in the manifest and so initialized by ... metadataLoaded() promise does not resolve in case of...
Read more >
sap.ui.model.odata.v2.ODataModel - API Reference - Demo Kit
If the POST request succeeds but the GET request for the navigation properties fails, the success handler is called with the data and...
Read more >
sap.ui.model.odata.v2.ODataModel - OPENUI5 SDK
Trigger a request to the function import odata service that was specified in the ... metadataLoaded()Returns a promise for the loaded state of...
Read more >
How to Handle Promises in React - Upmostly
To construct a Promise from scratch, you can use the Promise constructor. This takes a function which takes two parameters: “resolve”, a function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found