# Terminate after warning is thrown - global setting

**URL:** <https://discourse.julialang.org/t/terminate-after-warning-is-thrown-global-setting/80368>\
**Category:** General Usage\
**Tags:** warning, control-flow\
**Created:** [May 2, 2022, 2:17pm UTC](https://discourse.julialang.org/t/terminate-after-warning-is-thrown-global-setting/80368 "2022-05-02T14:17:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 2, 2022, 2:35pm UTC](https://discourse.julialang.org/t/terminate-after-warning-is-thrown-global-setting/80368/2 "2022-05-02T14:35:36Z")

</div>

Julia doesn’t “throw” warnings. However, warning messages are typically written to the `stderr` stream, so you can turn such warnings to errors simply by redirecting `stderr` to a read-only stream:

```julia
julia> redirect_stderr(open(touch(tempname()), "r"))
IOStream(<file ...>)

julia> @warn "foo"
ERROR: ArgumentError: write failed, IOStream is not writeable

```

(With a bit more work, I guess you could change `stderr` to a pipeline of some sort that captures the warning message and re-prints it.)

---

_[View the full topic](https://discourse.julialang.org/t/terminate-after-warning-is-thrown-global-setting/80368)._
