Skip to Content
0

Unable to identify NetworkError (code 0) in 1.38.7 (Older version 1.28.38 works)

Nov 22, 2016 at 03:06 PM

83

avatar image
Former Member

Hello Experts,

I'm developing a mobile application in SAPUI5.

I need to check 'Network error' (no connection)
In SAPUI5 1.28.38 in the callback function of the attachRequestFailed function of the model I can get the statusCode parameter if the value is 0 it's a network error
The console in this case:
The following problem occurred: error - undefined,0,NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://<server>:<port>/testlogin/CheckLoginServlet'. ", source: https://<server>:<port>/sapui5_128/resources/sap-ui-core.js (88)

However in SAPUI5 1.38.7 this is the console:
"Uncaught TypeError: Cannot read property 'status' of undefined", source: https://<server>:<port>/sapui5_138/resources/sap/ui/core/library-preload.json/sap/ui/model/json/JSONModel.js (6)
And statusCode cannot be read (because exception occurs in SAP class).

Why the newer version doesn't have the 0 statusCode? and what is the best way to check if network connection available?

Regards,
Omri

10 |10000 characters needed characters left characters exceeded
Former Member

I ended up using the code from this thread:

http://stackoverflow.com/questions/2384167/check-if-internet-connection-exists-with-javascript

This way I'm not bound to SAPUI5 specific version.

Regards,
Omri

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers