Exception: Twilic::Core::Errors::TwilicError
- Inherits:
-
StandardError
- Object
- StandardError
- Twilic::Core::Errors::TwilicError
- Defined in:
- lib/twilic/core/errors.rb
Instance Attribute Summary collapse
-
#byte ⇒ Object
readonly
Returns the value of attribute byte.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#ref_id ⇒ Object
readonly
Returns the value of attribute ref_id.
-
#ref_kind ⇒ Object
readonly
Returns the value of attribute ref_kind.
Instance Method Summary collapse
-
#initialize(kind, byte: nil, msg: nil, ref_kind: nil, ref_id: nil) ⇒ TwilicError
constructor
A new instance of TwilicError.
- #message ⇒ Object
Constructor Details
#initialize(kind, byte: nil, msg: nil, ref_kind: nil, ref_id: nil) ⇒ TwilicError
Returns a new instance of TwilicError.
17 18 19 20 21 22 23 24 |
# File 'lib/twilic/core/errors.rb', line 17 def initialize(kind, byte: nil, msg: nil, ref_kind: nil, ref_id: nil) @kind = kind @byte = byte @msg = msg @ref_kind = ref_kind @ref_id = ref_id super() end |
Instance Attribute Details
#byte ⇒ Object (readonly)
Returns the value of attribute byte.
15 16 17 |
# File 'lib/twilic/core/errors.rb', line 15 def byte @byte end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
15 16 17 |
# File 'lib/twilic/core/errors.rb', line 15 def kind @kind end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
15 16 17 |
# File 'lib/twilic/core/errors.rb', line 15 def msg @msg end |
#ref_id ⇒ Object (readonly)
Returns the value of attribute ref_id.
15 16 17 |
# File 'lib/twilic/core/errors.rb', line 15 def ref_id @ref_id end |
#ref_kind ⇒ Object (readonly)
Returns the value of attribute ref_kind.
15 16 17 |
# File 'lib/twilic/core/errors.rb', line 15 def ref_kind @ref_kind end |
Instance Method Details
#message ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/twilic/core/errors.rb', line 26 def case kind when UNEXPECTED_EOF "unexpected end of input" when INVALID_KIND format("invalid message kind: 0x%02x", byte) when INVALID_TAG format("invalid value tag: 0x%02x", byte) when INVALID_DATA "invalid data: #{msg}" when UTF8 "utf8 decode error" when UNKNOWN_REFERENCE "unknown reference: #{ref_kind}=#{ref_id}" when STATELESS_RETRY_REQUIRED "stateless retry required for reference: #{ref_kind}=#{ref_id}" else "twilic error" end end |