lib/epics/error.rb in epics-1.4.1 vs lib/epics/error.rb in epics-1.5.0
- old
+ new
@@ -1,13 +1,25 @@
class Epics::Error < StandardError
+
+ attr_reader :code
+
def to_s
[@error.fetch("symbol", "EPICS_UNKNOWN"), @error.fetch("short_text", "unknown")].join(" - ")
end
def initialize(code)
@code = code
@error = self.class::ERRORS.fetch(code, {})
end
+
+ def symbol
+ @error.fetch("symbol", "EPICS_UNKNOWN")
+ end
+
+ def short_text
+ @error.fetch("short_text", "unknown")
+ end
+
class TechnicalError < self
ERRORS = {
"000000" => {
"symbol" => "EBICS_OK",
\ No newline at end of file