Project

General

Profile

Feature #11347

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

Hello, errors with `cause` are an important and very useful feature for debugging. It seems though default reporting is not showing the `cause` and nested causes to user. Here's a test file: 

 ~~~ruby 
 ~~~ 
 raise "GAHGAH" rescue raise "error with cause" rescue e=$! 

 puts "Error: #{e}" 
 puts "Cause: #{e.cause}" 

 raise e 
 ~~~ 

 As you can see, the `cause` of the error is not printed in any way to the console when error is raised: 

 
 ~~~ 
 $ ruby /tmp/test.rb  
 Error: error with cause 
 Cause: GAHGAH 
 /tmp/test.rb:1:in `rescue in <main>': error with cause (RuntimeError) 
	 from /tmp/test.rb:1:in `<main> 
 ~~~

Back