# Custom \`showerror\` doesn't always trigger

**URL:** <https://discourse.julialang.org/t/custom-showerror-doesnt-always-trigger/1937>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 6, 2017, 12:03pm UTC](https://discourse.julialang.org/t/custom-showerror-doesnt-always-trigger/1937 "2017-02-06T12:03:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [February 6, 2017, 12:03pm UTC](https://discourse.julialang.org/t/custom-showerror-doesnt-always-trigger/1937/1 "2017-02-06T12:03:31Z")

</div>

I’m having some trouble implementing a custom exception: the `showerror` only works in the REPL.

```julia
type Bad <: Exception
end

Base.showerror(io::IO, e::Bad) = print(io, "Good")

throw(Bad())

```

Doing this in the REPL calls into my `showerror`:

```julia
julia> throw(Bad())
ERROR: Good

```

But invoking as a script doesn’t:

```julia
$ julia /tmp/test.jl
ERROR: LoadError: Bad()

```

This definitely used to work in the past, and does work with exceptions part of the sysimg (eg. `PkgError`). Could this be a #265-fallout issue (possibly related to [#19864](https://github.com/JuliaLang/julia/issues/19864)), or am I missing something?

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [February 24, 2017, 7:49am UTC](https://discourse.julialang.org/t/custom-showerror-doesnt-always-trigger/1937/2 "2017-02-24T07:49:48Z")

</div>

Turned out to be world error, solved by [https://github.com/JuliaLang/julia/pull/20497](https://github.com/JuliaLang/julia/pull/20497)
