Exception: OPP::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, code: nil, path: nil) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
# File 'lib/opp/errors.rb', line 5

def initialize(message = nil, code: nil, path: nil)
  super(message)
  @code = code || self.class.name.split("::").last
    .gsub(/([a-z\d])([A-Z])/, "\\1_\\2").downcase.delete_suffix("_error")
  @path = path
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/opp/errors.rb', line 3

def code
  @code
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/opp/errors.rb', line 3

def path
  @path
end