Exception: NATS::JetStream::Error::APIError
- Inherits:
-
NATS::JetStream::Error
- Object
- StandardError
- IO::Error
- NATS::JetStream::Error
- NATS::JetStream::Error::APIError
- Defined in:
- lib/nats/io/jetstream/errors.rb
Overview
When the server responds with an error from the JetStream API.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#consumer ⇒ Object
Returns the value of attribute consumer.
-
#description ⇒ Object
Returns the value of attribute description.
-
#err_code ⇒ Object
Returns the value of attribute err_code.
-
#seq ⇒ Object
Returns the value of attribute seq.
-
#stream ⇒ Object
Returns the value of attribute stream.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ APIError
constructor
A new instance of APIError.
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ APIError
Returns a new instance of APIError.
47 48 49 50 51 52 53 54 |
# File 'lib/nats/io/jetstream/errors.rb', line 47 def initialize(params = {}) @code = params[:code] @err_code = params[:err_code] @description = params[:description] @stream = params[:stream] @consumer = params[:consumer] @seq = params[:seq] end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
45 46 47 |
# File 'lib/nats/io/jetstream/errors.rb', line 45 def code @code end |
#consumer ⇒ Object
Returns the value of attribute consumer.
45 46 47 |
# File 'lib/nats/io/jetstream/errors.rb', line 45 def consumer @consumer end |
#description ⇒ Object
Returns the value of attribute description.
45 46 47 |
# File 'lib/nats/io/jetstream/errors.rb', line 45 def description @description end |
#err_code ⇒ Object
Returns the value of attribute err_code.
45 46 47 |
# File 'lib/nats/io/jetstream/errors.rb', line 45 def err_code @err_code end |
#seq ⇒ Object
Returns the value of attribute seq.
45 46 47 |
# File 'lib/nats/io/jetstream/errors.rb', line 45 def seq @seq end |
#stream ⇒ Object
Returns the value of attribute stream.
45 46 47 |
# File 'lib/nats/io/jetstream/errors.rb', line 45 def stream @stream end |
Instance Method Details
#to_s ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/nats/io/jetstream/errors.rb', line 56 def to_s if @stream && @consumer "#{@description} (status_code=#{@code}, err_code=#{@err_code}, stream=#{@stream}, consumer=#{@consumer})" elsif @stream "#{@description} (status_code=#{@code}, err_code=#{@err_code}, stream=#{@stream})" else "#{@description} (status_code=#{@code}, err_code=#{@err_code})" end end |