Unit::ArithmeticError
Inherits Unit::UnitError < Exception < Reference < Object
Exception raised when arithmetic operations fail. This includes operations like adding incompatible units, division by zero, or other arithmetic constraints.
Example:
begin
weight = Weight.new(10, :kg)
weight / 0
rescue ex : Unit::ArithmeticError
puts ex.message # => "Arithmetic operation 'division' failed: Division by zero"
end
Constructors
Class methods
Instance methods
operation
Sourcereason
Source