Exception: Hootenanny::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/hootenanny/errors.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.wrap(exception) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/hootenanny/errors.rb', line 18

def self.wrap(exception)
  hootenanny_error = self.new(exception.message)

  hootenanny_error.set_backtrace exception.backtrace

  hootenanny_error
end

Instance Method Details

#as_json(options = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/hootenanny/errors.rb', line 10

def as_json(options = {})
  {
    error: {
      message: self.message
    }
  }
end

#to_hObject



4
5
6
7
8
# File 'lib/hootenanny/errors.rb', line 4

def to_h
  {
    message: self.message
  }
end