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

Better handle errors that come from the actual app. #1035

Merged
merged 1 commit into from Feb 18, 2021

Conversation

BobbyMcWho
Copy link
Member

As a consequence of the changes that were merged in #689, errors
thrown by strategies that utilize other_phase (or more specifically
call_app!), would be caught by omniauth, causing headaches for folks
looking to have those errors handled by their application. This
should allow for errors that come from the app to pass through, while
passing errors that come from the authentication phases to the fail!
handler.

Resolves #1030

As a consequence of the changes that were merged in #689, errors
thrown by strategies that utilize other_phase (or more specifically
call_app!), would be caught by omniauth, causing headaches for folks
looking to have those errors handled by their application. This
should allow for errors that come from the app to pass through, while
passing errors that come from the authentication phases to the fail!
handler.
Copy link

@pgwillia pgwillia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me. I can't think of a situation where the environment variable solution shouldn't work. The tests illustrate the exact situation that we experienced. Thanks @BobbyMcWho

@@ -462,6 +466,9 @@ def query_string

def call_app!(env = @env)
@app.call(env)
rescue StandardError => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if it would be possible to rescue a subclass of StandardError like OmniAuthError or something like that. I guess the challenge is that call_app is called from the other dependent gems (omniauth-saml, etc) and you can't really know what will be raised.

@BobbyMcWho BobbyMcWho merged commit 7e1b49f into master Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rescue StandardError makes all development errors failures
3 participants