godfat/rib — Issue #4: Error printing error with special formed backtrace path
Author: bootleq
Created: 2011-11-01 03:37:46+00:00
State: open

While `1 / 0` should raise ZeroDivisionError, rib 0.9.9 shows

Error while printing error:
NoMethodError: private method `sub' called for nil:NilClass

The problem:
https://github.com/godfat/rib/blob/master/lib/rib/more/color.rb#L66-68

path, rest = ::File.split(b)
name, msgs = rest.split(':', 2)
msg = msgs.sub(/(\d+):/){red{$1}+':'}.sub(/`.+?'/){green{$&}}

where `rest` can't be split into two, thus `msgs` is nil.
I think this can be avoided, bring original error to user.