diff --git a/src/ArgCheck.jl b/src/ArgCheck.jl index 86332b5..a1a2d41 100644 --- a/src/ArgCheck.jl +++ b/src/ArgCheck.jl @@ -111,9 +111,7 @@ function build_error(code, T::Type{<:Exception}, args...) ret end function build_error(code, msg::AbstractString) - ret = ArgumentError(msg) - warn("`@argcheck condition \"$msg\"` is deprecated. Use `@argcheck condition $ret` instead") - ret + ArgumentError(msg) end build_error(code, T::Type{<:Exception}=ArgumentError) = T("$code must hold.") build_error(code, err::Exception) = err diff --git a/test/runtests.jl b/test/runtests.jl index 453ad9a..fbba7c3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -166,11 +166,15 @@ end @argcheck issorted(xs...) end +@testset "custom message" begin + x = 0 + @test_throws ArgumentError @argcheck x > 1 "this should not happen" + @argcheck true "this should not happen" +end + @testset "deprecate" begin # deprecate err = @catch_exception_object @argcheck false MyExoticError 1 2 @test err === MyExoticError(1,2) - x = 0 - @test_throws ArgumentError @argcheck x > 1 "this should not happen" end