# Using @test\_throws for any error/excpeption

**URL:** <https://discourse.julialang.org/t/using-test-throws-for-any-error-excpeption/91609>\
**Category:** General Usage\
**Tags:** testing, error, exception, exceptions\
**Created:** [December 13, 2022, 5:13pm UTC](https://discourse.julialang.org/t/using-test-throws-for-any-error-excpeption/91609 "2022-12-13T17:13:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HashBrown](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hashbrown/32/43601_2.png) [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Post date:** [December 13, 2022, 5:13pm UTC](https://discourse.julialang.org/t/using-test-throws-for-any-error-excpeption/91609/1 "2022-12-13T17:13:37Z")

</div>

I want to test that certain uses of my code throws an error, however I am not concerned with exactly what type of error.

Is there a way to use @test\_throws without specifying the exact type of error?

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [December 13, 2022, 6:02pm UTC](https://discourse.julialang.org/t/using-test-throws-for-any-error-excpeption/91609/2 "2022-12-13T18:02:41Z")

</div>

You can specify the error type as `Exception`, which should catch all errors
