-
Notifications
You must be signed in to change notification settings - Fork 204
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
Response status checking #3
Comments
you could try doing the following
it will detect the 422 and if not will then just respond with a simple error message rather than the whole page, might be a start? |
I have actually added to it to catch a bit better error, when dealing with mainly laravel.
Initially, it would catch the 422 then supply the error with the response. I then try to catch two types of errors that are returned which I manage in my laravel php class something like:
But again this might be as it's tailored for me and my app As this might be for non laravel based apps you might need to, let the user actually, add their own method here themselves, as this is a great starter that you can add to yourself. But thought i mentioned what i have done, anyway |
here is my approach:
btw, I have removed onSuccess() since it has been doing not much. |
I have a concern about this piece of code:
Shouldn't you check if
error.response.status
is 422 before you record errors?If the server returns eg. 403 or 500, the
Errors::errors
would contain the whole HTML response which might cause some fatal errors.The text was updated successfully, but these errors were encountered: