# Handling exceptions in C

**URL:** https://discourse.julialang.org/t/handling-exceptions-in-c/23171
**Category:** General Usage
**Created:** [April 15, 2019, 7:48pm UTC](https://discourse.julialang.org/t/handling-exceptions-in-c/23171 "2019-04-15T19:48:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kim366](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kim366/32/5756_2.png) [@kim366](https://discourse.julialang.org/u/kim366)
#### Post date: [April 15, 2019, 7:48pm UTC](https://discourse.julialang.org/t/handling-exceptions-in-c/23171/1 "2019-04-15T19:48:42Z")

</div>

`jl_checked_assignment(jl_get_binding_wr(jl_main_module, jl_symbol("Main"), 0), jl_box_int64(7));` terminates the program preventing me from checking `jl_exception_occurred()`. Only `JL_TRY`/`JL_CATCH` works. In which case do I use which?

EDIT: From what I’ve found these hard coded errors work differently than Julia exceptions:

```julia
try
  Main = 3
catch e
  println("You should have entered a numeric value")
end

```

never reaches the catch block. Syntax errors also are examples of these errors. What’s a fitting name encapsulating these?
