Exception: Rabbit::Receiving::MalformedMessage
- Inherits:
-
StandardError
- Object
- StandardError
- Rabbit::Receiving::MalformedMessage
- Defined in:
- lib/rabbit/receiving/malformed_message.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#message_model ⇒ Object
Returns the value of attribute message_model.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message_model, errors) ⇒ MalformedMessage
constructor
A new instance of MalformedMessage.
Constructor Details
#initialize(message_model, errors) ⇒ MalformedMessage
Returns a new instance of MalformedMessage.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rabbit/receiving/malformed_message.rb', line 17 def initialize(, errors) self. = self.errors = Array(errors) errors_list = Array(errors).map { |e| " - #{e}" }.join("\n") super(<<~MESSAGE) Malformed message rejected for following reasons: #{errors_list} Message: #{.attributes.inspect} MESSAGE end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
5 6 7 |
# File 'lib/rabbit/receiving/malformed_message.rb', line 5 def errors @errors end |
#message_model ⇒ Object
Returns the value of attribute message_model.
5 6 7 |
# File 'lib/rabbit/receiving/malformed_message.rb', line 5 def @message_model end |
Class Method Details
.logger ⇒ Object
7 8 9 |
# File 'lib/rabbit/receiving/malformed_message.rb', line 7 def self.logger @logger ||= Rabbit.config.malformed_logger end |
.raise!(message_model, errors, backtrace = caller(1)) ⇒ Object
11 12 13 14 15 |
# File 'lib/rabbit/receiving/malformed_message.rb', line 11 def self.raise!(, errors, backtrace = caller(1)) error = new(, errors) logger.error error. raise error, error., backtrace end |