alessandro1997/panther

View on GitHub
lib/panther/operation/errors/invalid_contract.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
module Panther
  module Operation
    module Errors
      class InvalidContract < Base
        attr_reader :errors

        def initialize(errors:, message: 'The contract for this operation was not respected')
          @errors = errors
          super message
        end

        def status
          :unprocessable_entity
        end

        protected

        def metadata
          { validation_errors: errors }
        end
      end
    end
  end
end