Exception: Turbocable::PublishError
- Defined in:
- lib/turbocable/errors.rb
Overview
Raised when a publish fails after all retries have been exhausted. Wraps the underlying NATS error and preserves diagnostic metadata.
Instance Attribute Summary collapse
-
#attempts ⇒ Integer
readonly
The number of publish attempts made (1 = no retries).
-
#subject ⇒ String
readonly
The NATS subject that was targeted.
Instance Method Summary collapse
-
#cause ⇒ Exception?
The underlying exception from the final attempt.
-
#initialize(message, subject:, attempts:, cause: nil) ⇒ PublishError
constructor
A new instance of PublishError.
Constructor Details
#initialize(message, subject:, attempts:, cause: nil) ⇒ PublishError
Returns a new instance of PublishError.
52 53 54 55 56 57 |
# File 'lib/turbocable/errors.rb', line 52 def initialize(, subject:, attempts:, cause: nil) super() @subject = subject @attempts = attempts @cause = cause end |
Instance Attribute Details
#attempts ⇒ Integer (readonly)
Returns the number of publish attempts made (1 = no retries).
46 47 48 |
# File 'lib/turbocable/errors.rb', line 46 def attempts @attempts end |
#subject ⇒ String (readonly)
Returns the NATS subject that was targeted.
43 44 45 |
# File 'lib/turbocable/errors.rb', line 43 def subject @subject end |
Instance Method Details
#cause ⇒ Exception?
Returns the underlying exception from the final attempt.
60 61 62 |
# File 'lib/turbocable/errors.rb', line 60 def cause @cause || super end |