Skip to content

Instantly share code, notes, and snippets.

@benhamill
Created March 21, 2012 20:16
Show Gist options
  • Save benhamill/2152419 to your computer and use it in GitHub Desktop.
Save benhamill/2152419 to your computer and use it in GitHub Desktop.
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
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