Created
May 23, 2017 00:53
-
-
Save civitaspo/415142e2d567ec5ff79827b35d50f9fb to your computer and use it in GitHub Desktop.
This file contains 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
require 'java' | |
class Error < Java::JavaLang::RuntimeException; end | |
class Error1 < Error; end | |
class Error2 < Error; end | |
class Error3 < Error; end | |
def err1 | |
raise Error1.new("err") | |
end | |
def err2 | |
begin | |
err1 | |
rescue Error1 => e | |
raise Error2.new(e) | |
end | |
end | |
def err3 | |
begin | |
err2 | |
rescue Error2 => e | |
raise Error3.new(e) | |
end | |
end | |
def err | |
begin | |
err3 | |
rescue => e | |
raise Error.new(e) | |
end | |
end | |
begin | |
err | |
rescue => e | |
$stderr.puts "e: {class:#{e.class},msg:#{e}}" | |
$stderr.puts "e.cause: {class:#{e.cause.class},msg:#{e.cause}}" | |
$stderr.puts "e.cause.cause: {class:#{e.cause.cause.class},msg:#{e.cause.cause}}" | |
$stderr.puts "e.cause.cause.cause: {class:#{e.cause.cause.cause.class},msg:#{e.cause.cause.cause}}" | |
end |
This file contains 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
e: {class:Error,msg:org.jruby.proxy.java.lang.RuntimeException$Proxy1: org.jruby.proxy.java.lang.RuntimeException$Proxy1: org.jruby.proxy.java.lang.RuntimeException$Proxy1: err} | |
e.cause: {class:Error3,msg:org.jruby.proxy.java.lang.RuntimeException$Proxy1: org.jruby.proxy.java.lang.RuntimeException$Proxy1: err} | |
e.cause.cause: {class:Error2,msg:org.jruby.proxy.java.lang.RuntimeException$Proxy1: err} | |
e.cause.cause.cause: {class:Error1,msg:err} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment