Exception: VirusScanner::Error
- Inherits:
-
StandardError
- Object
- StandardError
- VirusScanner::Error
- Defined in:
- lib/virus_scanner/errors.rb
Direct Known Subclasses
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(statement) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(statement) ⇒ Error
Returns a new instance of Error.
3 4 5 6 7 8 9 |
# File 'lib/virus_scanner/errors.rb', line 3 def initialize(statement) if statement.is_a?(Exception) @error = statement else @message = statement end end |
Instance Method Details
#backtrace ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/virus_scanner/errors.rb', line 15 def backtrace if @error error_backtrace = ["--- Backtrace from #{@error.class} ---"] + (@error.backtrace || []) wrapper_backtrace = ["--- Backtrace from #{self.class} ---"] + (super || []) error_backtrace + wrapper_backtrace else super end end |
#inspect ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/virus_scanner/errors.rb', line 25 def inspect if @error "#{error.inspect} (wrapped in a #{self.class})" else super end end |
#message ⇒ Object
11 12 13 |
# File 'lib/virus_scanner/errors.rb', line 11 def @message || "#{@error.class} (wrapped in #{self.class}) - #{@error.}" end |
#to_s ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/virus_scanner/errors.rb', line 33 def to_s if @error "#{@error.class} (wrapped in a #{self.class}) - #{@error}" else super end end |