Exception: Beowulf::BaseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/beowulf/base_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(error, cause = nil) ⇒ BaseError

Returns a new instance of BaseError.



3
4
5
6
# File 'lib/beowulf/base_error.rb', line 3

def initialize(error, cause = nil)
  @error = error
  @cause = cause
end

Instance Method Details

#to_sObject



8
9
10
11
12
13
14
# File 'lib/beowulf/base_error.rb', line 8

def to_s
  if !!@cause
    JSON[error: @error, cause: @cause] rescue {error: @error, cause: @cause}.to_s
  else
    JSON[@error] rescue @error
  end
end