Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No catch of the error if the server is down #86

Open
ilanfreoua opened this issue Oct 20, 2015 · 3 comments
Open

No catch of the error if the server is down #86

ilanfreoua opened this issue Oct 20, 2015 · 3 comments

Comments

@ilanfreoua
Copy link

Hello,

I am using angular-sails to connect my Node Server to an ionic application through Socket.io.
Its very functionnal and useful, Thanks ! ;)

But, if the server is down, i have this error :

WebSocket connection to 'ws://myapi.com:1337/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

I was not able to found any information if its possible to catch the error. Actually, if the server is down, this make crashing my app because of this error.. Is there a way to detect the error ? I mean, when I use Promises, I have the success callback which is triggered in case of 200 http response and error callbacks which are triggered in case of 404/502 errors, but the error callback is not triggered when the server is down.

Am I wrong on something ?

thank you

@ilanfreoua
Copy link
Author

anyone ?

I tried to use interceptors , but its not working as $http...

@TheSharpieOne
Copy link
Contributor

If you are using the 2.0 branch this issue can be addressed, but since the 1.0 branch uses sails.io.js it makes it hard to get at the error to catch it.

@ilanfreoua
Copy link
Author

Hmm I can intercept the error when its like 403 or 401, for this, i am using this :
$sailsProvider.interceptors.push('mySailsInterceptor');

but i would like to know if its possible to intercept if the connection is lost (no internet connection or the api server is down)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants