Exception: NATS::JetStream::Error::APIError

Inherits:
NATS::JetStream::Error show all
Defined in:
lib/nats/io/jetstream/errors.rb

Overview

When the server responds with an error from the JetStream API.

Direct Known Subclasses

BadRequest, NotFound, ServerError, ServiceUnavailable

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject

Returns the value of attribute code.



45
46
47
# File 'lib/nats/io/jetstream/errors.rb', line 45

def code
  @code
end

#consumerObject

Returns the value of attribute consumer.



45
46
47
# File 'lib/nats/io/jetstream/errors.rb', line 45

def consumer
  @consumer
end

#descriptionObject

Returns the value of attribute description.



45
46
47
# File 'lib/nats/io/jetstream/errors.rb', line 45

def description
  @description
end

#err_codeObject

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

#seqObject

Returns the value of attribute seq.



45
46
47
# File 'lib/nats/io/jetstream/errors.rb', line 45

def seq
  @seq
end

#streamObject

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_sObject



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