# Stop(msg) Julia Program

**URL:** <https://discourse.julialang.org/t/stop-msg-julia-program/10051>\
**Category:** General Usage\
**Created:** [March 29, 2018, 2:03pm UTC](https://discourse.julialang.org/t/stop-msg-julia-program/10051 "2018-03-29T14:03:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [March 29, 2018, 2:03pm UTC](https://discourse.julialang.org/t/stop-msg-julia-program/10051/1 "2018-03-29T14:03:33Z")

</div>

could you add a `stop(msg)` function that works like `error(msg)`, but replaces the word `ERROR` with `STOP` and does not print a stack backtrace?

/iaw

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [March 29, 2018, 2:32pm UTC](https://discourse.julialang.org/t/stop-msg-julia-program/10051/2 "2018-03-29T14:32:49Z")

</div>

It might be better to describe your use case and ask for a way to implement it using currently available language features (in Usage category). From multiple discussions here and on GitHub you can see that most core devs are overloaded working on Julia 0.7/1.0, and even beyond that they have a long, long list of desired features, so bringing another one without a good use case for many people is unlikely to get a response.

Yet, as you should’ve already noticed, Julia community is friendly and helps to solve many practical problems without changing the language.

(And if the problem is unsolvable in the current language, the best strategy for bringing a new feature is to make a pull request)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 29, 2018, 2:42pm UTC](https://discourse.julialang.org/t/stop-msg-julia-program/10051/3 "2018-03-29T14:42:54Z")

</div>

What about

```julia
struct Stop <: Exception end
Base.display_error(io::IO, ::Stop, _) = println(io, "STOP")
stop() = throw(Stop())

```

eg

```julia
julia> f() = stop()
f (generic function with 1 method)

julia> f()
STOP

```

PS.: I realized I forgot the message. Left as an exercise for the reader 😉

---

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [March 30, 2018, 12:36am UTC](https://discourse.julialang.org/t/stop-msg-julia-program/10051/4 "2018-03-30T00:36:19Z")

</div>

holy cow. this was easier than I thought. thanks, tamas.

---

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [June 17, 2021, 4:03pm UTC](https://discourse.julialang.org/t/stop-msg-julia-program/10051/5 "2021-06-17T16:03:19Z")

</div>

It seems that the @Tamas_Papp solution is not fully working in the last Julia version since the stack trace is still printed and the message not.
