diff --git a/Project.toml b/Project.toml index 8962c97..cb60a35 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ArgCheck" uuid = "dce04be8-c92d-5529-be00-80e4d2c0e197" license = "MIT" -version = "2.3.1" +version = "2.4.0" [compat] julia = "1" diff --git a/src/checks.jl b/src/checks.jl index 83cc125..79fb89c 100644 --- a/src/checks.jl +++ b/src/checks.jl @@ -288,7 +288,7 @@ function build_error(info) end function build_error(info, checkflavor, msg::AbstractString) E = default_exception_type(checkflavor) - E(msg) + E(msg * "\n" * error_message(info)) end function build_error(info, checkflavor, diff --git a/test/checks.jl b/test/checks.jl index 0dd3713..7e7b1ef 100644 --- a/test/checks.jl +++ b/test/checks.jl @@ -260,7 +260,8 @@ end @testset "custom message" begin x = 0 - @test_throws ArgumentError @argcheck x > 1 "this should not happen" + expected = ArgumentError("this should not happen\nx > 1 must hold. Got\nx => 0") + @test_throws expected @argcheck x > 1 "this should not happen" @argcheck true "this should not happen" end