Exception: JetstreamBridge::PublishError

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

Overview

Raised when an event fails to publish.

Instance Attribute Summary collapse

Attributes inherited from Error

#context

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, event_id: nil, subject: nil, context: {}) ⇒ PublishError

Returns a new instance of PublishError.

Parameters:

  • message (String, nil) (defaults to: nil)

    Human-readable error message

  • event_id (String, nil) (defaults to: nil)

    The event ID

  • subject (String, nil) (defaults to: nil)

    The NATS subject

  • context (Hash) (defaults to: {})

    Additional diagnostic context



48
49
50
51
52
# File 'lib/jetstream_bridge/errors.rb', line 48

def initialize(message = nil, event_id: nil, subject: nil, context: {})
  @event_id = event_id
  @subject = subject
  super(message, context: context.merge(event_id: event_id, subject: subject).compact)
end

Instance Attribute Details

#event_idString? (readonly)

Returns Event ID that failed to publish.

Returns:

  • (String, nil)

    Event ID that failed to publish



40
41
42
# File 'lib/jetstream_bridge/errors.rb', line 40

def event_id
  @event_id
end

#subjectString? (readonly)

Returns NATS subject the publish was attempted on.

Returns:

  • (String, nil)

    NATS subject the publish was attempted on



42
43
44
# File 'lib/jetstream_bridge/errors.rb', line 42

def subject
  @subject
end