batmanjs/batman — pull request #1008 by AndyObtiva (2014-03-21 01:58:40+00:00)
Title: Including 401 unauthorized error in Batman Model errors

Problem: When validating a user session email/password form, email and password presence/format validation errors show up in the model errors collection, but when authentication fails, the server-authentication error does not show up in that collection automatically just like other validation errors because it is a 401 unauthorized status as opposed to 422.

Solution: Made batman.rails include a 401 error produced when authenticating a user session (e.g. using Devise) in the Batman Model errors just like 422 validation errors, making it show up just like other validation errors when validating an email/password user session form.

Usage: this is used on a video streaming website project that I am leading, and so far there are no negative consequences to it. It is accomplishing our task well.

Feedback would be appreciated. For example, can you think of edge case scenarios that I am missing? Would there be benefit in adding other error statuses as well (or maybe do that in a separate pull request in the future)?

Thanks.

Andy