# Custom exception handler

**URL:** <https://discourse.julialang.org/t/custom-exception-handler/18946>\
**Category:** General Usage\
**Created:** [December 23, 2018, 5:08pm UTC](https://discourse.julialang.org/t/custom-exception-handler/18946 "2018-12-23T17:08:50Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [December 26, 2018, 9:32am UTC](https://discourse.julialang.org/t/custom-exception-handler/18946/5 "2018-12-26T09:32:57Z")

</div>

Ok, thanks. The guarded thing is basically the try/catch around all callbacks.

But I would like to focus more on:

> [@c42f](#):
>
> or the program will longjmp out of the GTK stack frames, likely corrupting the state of the C library (in which case you’ll have to add a try-catch yourself)

This has not so much tied to Gtk but the task machinery itself. What I observe is that sometimes the program crashed and sometimes nothing happens (no exception printed). I would argue that it would be better if the Julia runtime catches all exceptions. In C++ for instance all uncatched exceptions will call `std::terminate` which can be replaced.

---

_[View the full topic](https://discourse.julialang.org/t/custom-exception-handler/18946)._
