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

Handle ajax errors #300

Closed
wvengen opened this issue Jul 2, 2014 · 2 comments
Closed

Handle ajax errors #300

wvengen opened this issue Jul 2, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@wvengen
Copy link
Member

wvengen commented Jul 2, 2014

Currently errors during an ajax request are not handled, the user sees nothing. This may happen, for example, with the delta_input buttons in the order and balancing screen to change group_order_article amounts.

@wvengen wvengen added this to the 4.2 milestone Jul 2, 2014
@wvengen wvengen self-assigned this Jul 2, 2014
@wvengen
Copy link
Member Author

wvengen commented Jul 2, 2014

This is, unfortunately, not standard in Rails.

There are two cases here:

  1. An error condition is found in the code, or
  2. a server error occurs (resulting in an http 500 status code).

The second can be caught by jQuery's ajaxError() handler, and the first one too - when we return an http status code as suggested elsewhere too.

For validation errors, 422 would be suitable; what to use for other unexpected conditions? (E.g., when no member can be found for an ordergroup in foodcoop-adam#106.)

@wvengen
Copy link
Member Author

wvengen commented Jul 2, 2014

The commit also removes non-working ajax hooks; if you we, at some point, want to disable the submit button after submitting remote forms, this would be possible: http://www.railsonmaui.com/blog/2014/02/23/simple-form-and-disable-processing-by-default/
(even though I couldn't get it to work now).

@wvengen wvengen closed this as completed in d8f4ac4 Jul 2, 2014
wvengen added a commit to foodcoop-adam/foodsoft that referenced this issue Jul 2, 2014
Conflicts:
	app/assets/javascripts/application.js
wvengen added a commit to foodcoop-adam/foodsoft that referenced this issue Jul 2, 2014
Conflicts:
	app/assets/javascripts/application.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant