by yaxdotcom · 15y ago · 0 comments
I don't know if this proposal is optimal (smarter guys than me can decide that). But I know that a standard way of communicating application-specific errors would be a big step forward.
A year ago I searched for an adequate in-place editing plugin for Rails that didn't require major surgery to provide error messages to the user. I was surprised at the complexity required to handle a simple error condition. Usually Rails has all the goodness baked in but it seems application-specific status messages with JSON are out of scope. I asked "How to show server errors in Rails with JSON and jQuery" [1] on Stack Overflow and it's received more views than any other question I've ever asked.
[1] http://stackoverflow.com/questions/2489567/how-to-show-serve...
HTTP/1.1 422 Unprocessable Entity
{"error": "email address must contain @", "applies_to": "email_field"}