lib/unit_measurements/measurement.rb in unit_measurements-5.9.0 vs lib/unit_measurements/measurement.rb in unit_measurements-5.10.0
- old
+ new
@@ -102,17 +102,19 @@
# => 0.5 km
#
# @param [Numeric|String] quantity The quantity of the measurement.
# @param [String|Unit] unit The unit of the measurement.
#
- # @raise [BaseError] If +quantity+ or +unit+ is blank.
+ # @raise [BlankQuantityError] If +quantity+ is blank.
+ # @raise [BlankUnitError] If +unit+ is blank.
#
- # @see BaseError
+ # @see BlankQuantityError
+ # @see BlankUnitError
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
# @since 1.0.0
def initialize(quantity, unit)
- raise BaseError, "Quantity cannot be blank." if quantity.blank?
- raise BaseError, "Unit cannot be blank." if unit.blank?
+ raise BlankQuantityError if quantity.blank?
+ raise BlankUnitError if unit.blank?
@quantity = convert_quantity(quantity)
@unit = unit_from_unit_or_name!(unit)
end