Exception: ESM::Exception::ApplicationError

Inherits:
Error
  • Object
show all
Defined in:
lib/esm/exception.rb

Overview

This exception allows attaching extra data to the exception This is mainly used for exception embeds

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ApplicationError

Returns a new instance of ApplicationError.



13
14
15
16
17
18
19
20
# File 'lib/esm/exception.rb', line 13

def initialize(data)
  # So if #message is called, it will return that.
  super(data.to_s)

  # Store the embed in the message
  # I had to do it this way because StandardError converts the message to a string
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



11
12
13
# File 'lib/esm/exception.rb', line 11

def data
  @data
end