Exception: AbideDevUtils::Errors::GenericError

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

Overview

Generic error class. Errors in AbideDevUtil all follow the same format: “<msg> <subject>”. Each error has a default error message relating to error class name. Subjects should always be the thing that failed (file, class, data, etc.).

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject = nil, msg: self.class.default) ⇒ GenericError

Returns a new instance of GenericError.



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

def initialize(subject = nil, msg: self.class.default)
  @msg = msg
  @subject = subject
  message = subject.nil? ? @msg : "#{@msg} #{@subject}"
  super(message)
end

Class Attribute Details

.defaultObject (readonly)

Returns the value of attribute default.



14
15
16
# File 'lib/abide_dev_utils/errors/base.rb', line 14

def default
  @default
end

Instance Attribute Details

#subjectObject (readonly)

Returns the value of attribute subject.



17
18
19
# File 'lib/abide_dev_utils/errors/base.rb', line 17

def subject
  @subject
end