Skip to content

Commit 4c34768

Browse files
committed
Change non-unit error to assertion
1 parent 69cd180 commit 4c34768

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/symbolic_dimensions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Convert a quantity `q` with base SI units to the symbolic units of `qout`, for `
114114
Mathematically, the result has value `q / expand_units(qout)` and units `dimension(qout)`.
115115
"""
116116
function uconvert(qout::AbstractQuantity{<:Any, <:SymbolicDimensions}, q::AbstractQuantity{<:Any, <:Dimensions})
117-
isone(ustrip(qout)) || error("You passed a quantity with a non-unit value to uconvert.")
117+
@assert isone(ustrip(qout)) "You passed a quantity with a non-unit value to uconvert."
118118
qout_expanded = expand_units(qout)
119119
dimension(q) == dimension(qout_expanded) || throw(DimensionError(q, qout_expanded))
120120
new_val = ustrip(q) / ustrip(qout_expanded)

test/unittests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ end
604604
@test expand_units(qs) 5.0 * q
605605

606606
# Refuses to convert to non-unit quantities:
607-
@test_throws ErrorException uconvert(1.2us"m", 1.0u"m")
607+
@test_throws AssertionError uconvert(1.2us"m", 1.0u"m")
608608
VERSION >= v"1.8" &&
609609
@test_throws "You passed a quantity" uconvert(1.2us"m", 1.0u"m")
610610

0 commit comments

Comments
 (0)