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:
parent
b9bc3bb9de
commit
43577d3c6d
4 changed files with 7 additions and 7 deletions
|
@ -22,7 +22,7 @@ module OmniAuth
|
||||||
end
|
end
|
||||||
|
|
||||||
def raise_out!
|
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
|
end
|
||||||
|
|
||||||
def redirect_to_failure
|
def redirect_to_failure
|
||||||
|
|
|
@ -140,7 +140,7 @@ module OmniAuth
|
||||||
end
|
end
|
||||||
|
|
||||||
# Make sure that all of the args have been dealt with, otherwise error out.
|
# 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?
|
yield options if block_given?
|
||||||
end
|
end
|
||||||
|
@ -172,7 +172,7 @@ module OmniAuth
|
||||||
def call!(env) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
|
def call!(env) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
|
||||||
unless env['rack.session']
|
unless env['rack.session']
|
||||||
error = OmniAuth::NoSessionError.new('You must provide a session to use OmniAuth.')
|
error = OmniAuth::NoSessionError.new('You must provide a session to use OmniAuth.')
|
||||||
fail(error)
|
raise(error)
|
||||||
end
|
end
|
||||||
|
|
||||||
@env = env
|
@env = env
|
||||||
|
@ -310,7 +310,7 @@ module OmniAuth
|
||||||
# perform any information gathering you need to be able to authenticate
|
# perform any information gathering you need to be able to authenticate
|
||||||
# the user in this phase.
|
# the user in this phase.
|
||||||
def request_phase
|
def request_phase
|
||||||
fail(NotImplementedError)
|
raise(NotImplementedError)
|
||||||
end
|
end
|
||||||
|
|
||||||
def uid
|
def uid
|
||||||
|
|
|
@ -37,7 +37,7 @@ module OmniAuth
|
||||||
|
|
||||||
def strategy
|
def strategy
|
||||||
error = NotImplementedError.new('Including specs must define #strategy')
|
error = NotImplementedError.new('Including specs must define #strategy')
|
||||||
fail(error)
|
raise(error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ExampleStrategy
|
||||||
@fail = fail!(options[:failure]) if options[:failure]
|
@fail = fail!(options[:failure]) if options[:failure]
|
||||||
@last_env = env
|
@last_env = env
|
||||||
return @fail if @fail
|
return @fail if @fail
|
||||||
fail('Request Phase')
|
raise('Request Phase')
|
||||||
end
|
end
|
||||||
|
|
||||||
def callback_phase
|
def callback_phase
|
||||||
|
@ -53,6 +53,6 @@ class ExampleStrategy
|
||||||
@fail = fail!(options[:failure]) if options[:failure]
|
@fail = fail!(options[:failure]) if options[:failure]
|
||||||
@last_env = env
|
@last_env = env
|
||||||
return @fail if @fail
|
return @fail if @fail
|
||||||
fail('Callback Phase')
|
raise('Callback Phase')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue