diff --git a/src/systems/unit_check.jl b/src/systems/unit_check.jl index 4086da9a30..a3a3ec076a 100644 --- a/src/systems/unit_check.jl +++ b/src/systems/unit_check.jl @@ -165,17 +165,17 @@ end """ Get unit of term, returning nothing & showing warning instead of throwing errors. """ -function safe_get_unit(term, info) +function safe_get_unit(term, info, verbose=true) side = nothing try side = get_unit(term) catch err if err isa DQ.DimensionError - @warn("$info: $(err.x) and $(err.y) are not dimensionally compatible.") + verbose && @warn("$info: $(err.x) and $(err.y) are not dimensionally compatible.") elseif err isa ValidationError - @warn(info*err.message) + verbose && @warn(info*err.message) elseif err isa MethodError - @warn("$info: no method matching $(err.f) for arguments $(typeof.(err.args)).") + verbose && @warn("$info: no method matching $(err.f) for arguments $(typeof.(err.args)).") else rethrow() end