Sha256: e11946988826a91ecebb2ddefef8e00f71b573baa6bbcdfab2dc7918fb29ad71

Contents?: true

Size: 511 Bytes

Versions: 10

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result::Contract::Error < BCDD::Result::Error
  class UnexpectedType < self
    def self.build(type:, allowed_types:)
      new("type :#{type} is not allowed. Allowed types: #{allowed_types.map(&:inspect).join(', ')}")
    end
  end

  class UnexpectedValue < self
    def self.build(type:, value:, cause: nil)
      cause_message = " (#{cause.message})" if cause

      new("value #{value.inspect} is not allowed for :#{type} type#{cause_message}")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bcdd-result-1.1.0 lib/bcdd/result/contract/error.rb
bcdd-result-1.0.0 lib/bcdd/result/contract/error.rb
bcdd-result-0.13.0 lib/bcdd/result/contract/error.rb
bcdd-result-0.12.0 lib/bcdd/result/contract/error.rb
bcdd-result-0.11.0 lib/bcdd/result/contract/error.rb
bcdd-result-0.10.0 lib/bcdd/result/contract/error.rb
bcdd-result-0.9.1 lib/bcdd/result/contract/error.rb
bcdd-result-0.9.0 lib/bcdd/result/contract/error.rb
bcdd-result-0.8.0 lib/bcdd/result/contract/error.rb
bcdd-result-0.7.0 lib/bcdd/result/contract/error.rb