# Propagating exceptions from MATLAB to Julia

**URL:** <https://discourse.julialang.org/t/propagating-exceptions-from-matlab-to-julia/24177>\
**Category:** General Usage\
**Tags:** question, matlab, exception\
**Created:** [May 13, 2019, 2:34pm UTC](https://discourse.julialang.org/t/propagating-exceptions-from-matlab-to-julia/24177 "2019-05-13T14:34:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [May 13, 2019, 2:34pm UTC](https://discourse.julialang.org/t/propagating-exceptions-from-matlab-to-julia/24177/1 "2019-05-13T14:34:50Z")

</div>

I’ve posted [an issue](https://github.com/JuliaInterop/MATLAB.jl/issues/157) mentioning this in `MATLAB.jl` a few months ago, but maybe someone here has an idea. I’m looking for a way to have exceptions inside Matlab propagate to Julia. Right now they might elicit some printout (e.g. `Undefined function or variable…`) but they are silent otherwise:

```julia
using MATLAB
mat"""
xxx - 1 % no xxx variable present, the error is silent for Julia
$x = 2
"""
@assert x == 2 # clears fine, even though the Matlab code (silently) failed.

```

Any one has a bright idea or functioning hack…?
