Created
March 21, 2012 20:16
-
-
Save benhamill/2152419 to your computer and use it in GitHub Desktop.
Gists for this blog post: http://inside.oib.com/getting-more-information-from-omniauth-exceptions/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OmniAuth.config.on_failure do |env| | |
exception = env['omniauth.error'] | |
error_type = env['omniauth.error.type'] | |
strategy = env['omniauth.error.strategy'] | |
Rails.logger.error("OmniAuth Error (#{error_type}): #{exception.inspect}") | |
ErrorNotifier.exception(exception, :strategy => strategy.inspect, :error_type => error_type) | |
new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{error_type}" | |
[302, {'Location' => new_path, 'Content-Type'=> 'text/html'}, []] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Proc.new do |env| | |
message_key = env['omniauth.error.type'] | |
new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}" | |
[302, {'Location' => new_path, 'Content-Type'=> 'text/html'}, []] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment