# Custom error message from @test macro

**URL:** <https://discourse.julialang.org/t/custom-error-message-from-test-macro/2299>\
**Category:** General Usage\
**Created:** [February 25, 2017, 2:16pm UTC](https://discourse.julialang.org/t/custom-error-message-from-test-macro/2299 "2017-02-25T14:16:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [February 25, 2017, 2:16pm UTC](https://discourse.julialang.org/t/custom-error-message-from-test-macro/2299/1 "2017-02-25T14:16:40Z")

</div>

Is there a way to specify a custom error message for the @test macro to print if it fails? Something like,

```julia
@test a==b "a didn't equal b"

```

The problem is that e.g. if a and b are large vectors then if the test fails they get fully printed to the output making the result basically unreadable.

---

<div class="post-metadata">

**Author:** ![pdobacz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdobacz/32/1775_2.png) [@pdobacz](https://discourse.julialang.org/u/pdobacz)\
**Post date:** [November 20, 2017, 9:50pm UTC](https://discourse.julialang.org/t/custom-error-message-from-test-macro/2299/2 "2017-11-20T21:50:00Z")

</div>

Hi, I just stumbled upon a similar problem and found this thread. You can try this as workaround:

```julia
@test a==b || "a didn't equal b"

```

---

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [November 20, 2017, 11:05pm UTC](https://discourse.julialang.org/t/custom-error-message-from-test-macro/2299/3 "2017-11-20T23:05:33Z")

</div>

That’s nice, thanks!
