Skip to content

Commit

Permalink
another lolfix until i try to grok it properly
Browse files Browse the repository at this point in the history
  • Loading branch information
banister committed Feb 2, 2012
1 parent 0de451e commit 140aab3
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions lib/pry-exception_explorer/core_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,38 @@ class Object
# We monkey-patch the `raise` method so we can intercept exceptions
def raise(*args)
exception, string, array = args

if exception.is_a?(String)
string = exception
exception = RuntimeError
end

if exception.is_a?(Exception)
return super(*args)
elsif exception.nil?
if $!
return super($!)
if !PryExceptionExplorer.enabled?
if exception.is_a?(Exception)
return super(*args)
elsif exception.nil?
if $!
return super($!)
else
return super(RuntimeError)
end
else
return super(RuntimeError)
return super(*args)
end
else
end

if string
ex = exception.exception(string)
ex.set_backtrace(array ? array : caller)
else
ex = exception.exception
end

ex.set_backtrace(array ? array : caller)

# revert to normal exception behaviour if EE not enabled.
if !PryExceptionExplorer.enabled?
return super(*args)
end
# if !PryExceptionExplorer.enabled?
# return super(*args)
# end

intercept_object = PryExceptionExplorer.intercept_object

Expand Down

0 comments on commit 140aab3

Please sign in to comment.