Exception: Turbocable::PayloadTooLargeError

Inherits:
Error
  • Object
show all
Defined in:
lib/turbocable/errors.rb

Overview

Raised when the encoded payload exceeds config.max_payload_bytes. The limit is checked client-side before touching NATS so callers get a useful error rather than a cryptic NATS-level rejection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(byte_size:, limit:) ⇒ PayloadTooLargeError

Returns a new instance of PayloadTooLargeError.

Parameters:

  • byte_size (Integer)
  • limit (Integer)


95
96
97
98
99
# File 'lib/turbocable/errors.rb', line 95

def initialize(byte_size:, limit:)
  super("Encoded payload is #{byte_size} bytes, exceeding the #{limit}-byte limit")
  @byte_size = byte_size
  @limit = limit
end

Instance Attribute Details

#byte_sizeInteger (readonly)

Returns the byte size of the encoded payload.

Returns:

  • (Integer)

    the byte size of the encoded payload



88
89
90
# File 'lib/turbocable/errors.rb', line 88

def byte_size
  @byte_size
end

#limitInteger (readonly)

Returns the configured limit.

Returns:

  • (Integer)

    the configured limit



91
92
93
# File 'lib/turbocable/errors.rb', line 91

def limit
  @limit
end