RubyMoney/money · error · TypeError
Unsupported argument type: #{other.class.name}
Error message
Unsupported argument type: #{other.class.name} What it means
Error "Unsupported argument type: #{other.class.name}" thrown in RubyMoney/money.
Source
Thrown at lib/money/money/arithmetic.rb:161
"Can't add or subtract a non-zero #{value.class.name} value"
end
define_method(op) do |other|
case other
when Money
other = other.exchange_to(currency)
new_fractional = fractional.public_send(op, other.fractional)
dup_with(fractional: new_fractional)
when CoercedNumeric
raise TypeError, non_zero_message.call(other.value) unless other.zero?
dup_with(fractional: other.value.public_send(op, fractional))
when Numeric
raise TypeError, non_zero_message.call(other) unless other.zero?
self
else
raise TypeError, "Unsupported argument type: #{other.class.name}"
end
end
end
# Multiplies the monetary value with the given number and returns a new
# +Money+ object with this monetary value and the same currency.
#
# Note that you can't multiply a Money object by an other +Money+ object.
#
# @param [Numeric] value Number to multiply by.
#
# @return [Money] The resulting money.
#
# @raise [TypeError] If +value+ is NOT a number.
#
# @example
# Money.new(100) * 2 #=> #<Money @fractional=200>
#View on GitHub (pinned to 26e2829c34)
When it happens
Trigger: Thrown at lib/money/money/arithmetic.rb:161 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RubyMoney/money@26e2829c34 (2026-08-23).
Data as JSON: /api/errors/77e7d4a15882c031.
Report an issue: GitHub.