# @test\_throws make it difficult to debug unexpected exceptions

**URL:** <https://discourse.julialang.org/t/test-throws-make-it-difficult-to-debug-unexpected-exceptions/67698>\
**Category:** General Usage\
**Created:** [September 4, 2021, 4:16pm UTC](https://discourse.julialang.org/t/test-throws-make-it-difficult-to-debug-unexpected-exceptions/67698 "2021-09-04T16:16:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Nahabedian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mark_nahabedian/32/16562_2.png) [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Post date:** [September 4, 2021, 4:16pm UTC](https://discourse.julialang.org/t/test-throws-make-it-difficult-to-debug-unexpected-exceptions/67698/1 "2021-09-04T16:16:42Z")

</div>

I’m using `@test_throws` in a unit test to verify that the case being tested throws an expected exception.

When that code throws a dipperent exception the test fails without giving a stack trace. It seems to me that if a different exception is thrown that is a program bug that should be investigated, just like if the exception occurred ouside of the context of @test\_throws.

Is there something like @test\_throws that behaves in this way, or should I just use try/catch instead of @test\_throws? I did a bit of searching but didn['t find one.
