Exception: Saro::Dat::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Saro::Dat::Error
- Defined in:
- lib/saro/dat/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
Class Method Summary collapse
Instance Method Summary collapse
- #cause ⇒ Object
-
#initialize(code, detail = nil, cause: nil) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #retry ⇒ Object
- #security_event? ⇒ Boolean
Constructor Details
#initialize(code, detail = nil, cause: nil) ⇒ Error
Returns a new instance of Error.
76 77 78 79 80 81 |
# File 'lib/saro/dat/error.rb', line 76 def initialize(code, detail = nil, cause: nil) @code = code @detail = detail @explicit_cause = cause super(detail ? "#{code}: #{detail}" : code) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
73 74 75 |
# File 'lib/saro/dat/error.rb', line 73 def code @code end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
74 75 76 |
# File 'lib/saro/dat/error.rb', line 74 def detail @detail end |
Class Method Details
.code_of(e) ⇒ Object
107 108 109 |
# File 'lib/saro/dat/error.rb', line 107 def code_of(e) e.is_a?(Error) ? e.code : nil end |
.wrap(code, detail, e) ⇒ Object
111 112 113 114 |
# File 'lib/saro/dat/error.rb', line 111 def wrap(code, detail, e) return e if e.is_a?(Error) new(code, detail, cause: e) end |
Instance Method Details
#cause ⇒ Object
83 84 85 |
# File 'lib/saro/dat/error.rb', line 83 def cause @explicit_cause || super end |
#inspect ⇒ Object
102 103 104 |
# File 'lib/saro/dat/error.rb', line 102 def inspect "#<Saro::Dat::Error #{@code}#{@detail ? " #{@detail.inspect}" : ''}>" end |
#retry ⇒ Object
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/saro/dat/error.rb', line 87 def retry if @code == ErrorCode::MANAGER_NO_ISSUABLE_CERTIFICATE c = cause return :transient if c.is_a?(Error) && c.code == ErrorCode::CERT_NOT_YET_ISSUABLE return :permanent end return :transient if ErrorCode::TRANSIENT.include?(@code) return :state if ErrorCode::STATE.include?(@code) :permanent end |