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

Custom handling of 4xx, 5xx status responses #129

Open
unirgy opened this issue Jan 11, 2017 · 1 comment
Open

Custom handling of 4xx, 5xx status responses #129

unirgy opened this issue Jan 11, 2017 · 1 comment

Comments

@unirgy
Copy link

unirgy commented Jan 11, 2017

Hello, my situation is: i'm using require.js to load json configurations, which are dynamically generated by a server script, but are inaccessible when there's no logged in session, and returns status 401. I'd like to capture this situation and redirect to login screen when this happens.

in the docs I've only found config.text.onXhrComplete, but the execution doesn't reach this callback if status is 4xx or 5xx. In the code I've found errback(err.xhr) and apparently it calls onLoad.error, but I can't find how to set this onLoad.error.

Is this implemented as configuration, or needs to be customized in core?

Thanks.

@venkateshnadar8
Copy link

This link can help you out.

http://requirejs.org/docs/api.html#errors

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