jeffersongirao/omniauth-dwolla — pull request #3 by coreyti (2012-10-19 10:42:05+00:00)
Title: Add handling of Dwolla::RequestException

By wrapping and re-raising the `Dwolla::RequestException` as a `CallbackException`, OmniAuth OAuth2 handles it well (as an 'invalid credentials' failure) and allows the app's authentication/authorization engine to process as needed.

For example, in the case of Devise, the default behavior is to fail user authentication. This can easily be adjusted based on the wrapped exception to, for example, let the user know that Dwolla payment permission was not received.

Without this change, the original `Dwolla::RequestException` is passed up the chain. For OAuth-based applications, the exception is never handled in the OAuth layer. In the case of Devise, this means the exception causes the application to have an un-handled error, rather than refusing authentication as one would expect.