Exception: Epics::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/epics/error.rb

Direct Known Subclasses

BusinessError, TechnicalError

Defined Under Namespace

Classes: BusinessError, TechnicalError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Error

Returns a new instance of Error.



9
10
11
12
# File 'lib/epics/error.rb', line 9

def initialize(code)
  @code = code
  @error = self.class::ERRORS.fetch(code, {})
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/epics/error.rb', line 3

def code
  @code
end

Instance Method Details

#short_textObject



18
19
20
# File 'lib/epics/error.rb', line 18

def short_text
  @error.fetch("short_text", "unknown")
end

#symbolObject



14
15
16
# File 'lib/epics/error.rb', line 14

def symbol
  @error.fetch("symbol", "EPICS_UNKNOWN")
end

#to_sObject



5
6
7
# File 'lib/epics/error.rb', line 5

def to_s
  [@error.fetch("symbol", "EPICS_UNKNOWN"), @error.fetch("short_text", "unknown")].join(" - ")
end