Sha256: cf9b31026b451602ce5ef0fd45595b73138b79a9b358aa8de94bdf01f79d5c76
Contents?: true
Size: 788 Bytes
Versions: 12
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module Rabbit::Receiving class MalformedMessage < StandardError attr_accessor :message_model, :errors def self.logger @logger ||= Rabbit.config.malformed_logger end def self.raise!(message_model, errors, backtrace = caller(1)) error = new(message_model, errors) logger.error error.message raise error, error.message, backtrace end def initialize(message_model, errors) self.message_model = message_model self.errors = Array(errors) errors_list = Array(errors).map { |e| " - #{e}" }.join("\n") super(<<~MESSAGE) Malformed message rejected for following reasons: #{errors_list} Message: #{message_model.attributes.inspect} MESSAGE end end end
Version data entries
12 entries across 12 versions & 1 rubygems