Sha256: 2ee95d1117de8dd4e768c1df74b4dfad8eb73587796fc4966cc8ab93f99cac80

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

module Mint
  # When currency type is unrecognized
  class WrongCurrencyError < ArgumentError
    def initialize(value)
      super "Can't find #{value} currency, please setup it with Mint::Money.conversion.rates"
    end
  end

  # When money type is unrecognized
  class WrongMoneyError < TypeError
    def initialize(value)
      super "Wrong amount's type #{value.inspect}, should be Float, BigDecimal or Mint::Money"
    end
  end

  # When a conversion need to setup currency rate
  class WrongConversionError < ArgumentError
    def initialize(msg)
      super "Can't convert #{msg} without conversion rates"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mint-money-0.1.1 lib/mint/money/exceptions.rb