1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Always use raise to signal exceptions

This commit is contained in:
Erik Michaels-Ober 2016-08-08 10:53:36 -07:00
parent b9bc3bb9de
commit 43577d3c6d
4 changed files with 7 additions and 7 deletions

View file

@ -22,7 +22,7 @@ module OmniAuth
end
def raise_out!
fail(env['omniauth.error'] || OmniAuth::Error.new(env['omniauth.error.type']))
raise(env['omniauth.error'] || OmniAuth::Error.new(env['omniauth.error.type']))
end
def redirect_to_failure

View file

@ -140,7 +140,7 @@ module OmniAuth
end
# Make sure that all of the args have been dealt with, otherwise error out.
fail(ArgumentError.new("Received wrong number of arguments. #{args.inspect}")) unless args.empty?
raise(ArgumentError.new("Received wrong number of arguments. #{args.inspect}")) unless args.empty?
yield options if block_given?
end
@ -172,7 +172,7 @@ module OmniAuth
def call!(env) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
unless env['rack.session']
error = OmniAuth::NoSessionError.new('You must provide a session to use OmniAuth.')
fail(error)
raise(error)
end
@env = env
@ -310,7 +310,7 @@ module OmniAuth
# perform any information gathering you need to be able to authenticate
# the user in this phase.
def request_phase
fail(NotImplementedError)
raise(NotImplementedError)
end
def uid

View file

@ -37,7 +37,7 @@ module OmniAuth
def strategy
error = NotImplementedError.new('Including specs must define #strategy')
fail(error)
raise(error)
end
end
end

View file

@ -45,7 +45,7 @@ class ExampleStrategy
@fail = fail!(options[:failure]) if options[:failure]
@last_env = env
return @fail if @fail
fail('Request Phase')
raise('Request Phase')
end
def callback_phase
@ -53,6 +53,6 @@ class ExampleStrategy
@fail = fail!(options[:failure]) if options[:failure]
@last_env = env
return @fail if @fail
fail('Callback Phase')
raise('Callback Phase')
end
end