Exception: Checkup::Errors::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Checkup::Errors::Error
- Defined in:
- lib/checkup/errors.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(msg = nil, orig_err = nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(msg = nil, orig_err = nil) ⇒ Error
Returns a new instance of Error.
36 37 38 39 |
# File 'lib/checkup/errors.rb', line 36 def initialize(msg = nil, orig_err = nil) super(msg) set_backtrace(orig_err.backtrace) if @orig_err = orig_err end |
Class Method Details
.wrap(orig_err, msg = nil) ⇒ Object
32 33 34 |
# File 'lib/checkup/errors.rb', line 32 def self.wrap(orig_err, msg = nil) new(msg, orig_err) end |
Instance Method Details
#to_s ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/checkup/errors.rb', line 41 def to_s return @to_s if @to_s orig_to_s = super() if orig_to_s == self.class.to_s msg = orig_err_msg ? "#{orig_err_class}: #{orig_err_msg}" : orig_err_class else msg = format_msg(orig_to_s) msg << "\n Reason: #{orig_err_class}" + (orig_err_msg ? "\n #{orig_err_msg}" : ' (no message given)') if @orig_err end @to_s = msg ? msg_prefix + msg : class_name end |