From 77ecabbbadee99a0baf990860ac31d0982ba25ec Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:57:48 +0530 Subject: [PATCH] feat: provision for non-verbose `safe_get_unit` --- src/systems/unit_check.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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