Exception: Broadcast::WarningError

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

Overview

Raised instead of returning when config.warnings_mode is :raise and a 2xx response carried warnings. The request DID succeed — the write happened. Callers rescuing this must not assume anything was rolled back.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(warnings, response = nil) ⇒ WarningError

Returns a new instance of WarningError.



43
44
45
46
47
# File 'lib/broadcast/errors.rb', line 43

def initialize(warnings, response = nil)
  @warnings = warnings
  @response = response
  super("API returned #{warnings.size} warning(s): #{warnings.join('; ')}")
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



41
42
43
# File 'lib/broadcast/errors.rb', line 41

def response
  @response
end

#warningsObject (readonly)

Returns the value of attribute warnings.



41
42
43
# File 'lib/broadcast/errors.rb', line 41

def warnings
  @warnings
end