Project

justified

0.0
No commit activity in last 3 years
No release in over 3 years
Provides causes for exceptions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Justified

Build Status

A mini-gem to add missing causes to exception backtrace-s like Java has. This gem will add following at the bottom of a backtrace:

    from caused by: (AnError) an ugly bug
    from justified.rb:83:in `bad_code'
    from     ... skipped 4 lines

Exception cause can be also accessed with #cause method which returns nil or an Exception.

Example

require 'justified/standard_error'

begin 
  raise 'a cause'
rescue
  raise 'an exception'
end

will print

file.rb:6:in `rescue in <main>': an exception (RuntimeError)
  	from file.rb:3:in `<main>'
  	from caused by: (RuntimeError) a cause
  	from file.rb:4:in `<main>'
  	from     ... skipped 0 lines

Links