# Error handling in JuMP

**URL:** <https://discourse.julialang.org/t/error-handling-in-jump/13584>\
**Category:** Optimization (Mathematical)\
**Created:** [August 16, 2018, 7:09pm UTC](https://discourse.julialang.org/t/error-handling-in-jump/13584 "2018-08-16T19:09:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shoshievass](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shoshievass/32/3260_2.png) [@shoshievass](https://discourse.julialang.org/u/shoshievass)\
**Post date:** [August 16, 2018, 7:09pm UTC](https://discourse.julialang.org/t/error-handling-in-jump/13584/1 "2018-08-16T19:09:47Z")

</div>

I’m trying to use a JuMP model as an input to an ODE solver (using the DifferentialEquations.jl package). It seems to work well most of the time, but occasionally, the solver will output warnings at intermediate values along the ODE solver, e.g.

```julia
WARNING: Not solved to optimality, status: Error
WARNING: Ipopt finished with status Search_Direction_Becomes_Too_Small
WARNING: Not solved to optimality, status: Error

```

Is there a suggested workflow for how to handle these kinds of errors so as to make the call to the jump optimization try to troubleshoot itself (as the outer ode solver goes along)?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 16, 2018, 8:41pm UTC](https://discourse.julialang.org/t/error-handling-in-jump/13584/2 "2018-08-16T20:41:15Z")

</div>

In JuMP 0.18, you should check the `status` symbol that is returned from the `solve` function. Maybe something like

```julia
status = solve(model)
if status == :Optimal
    # carry on as normal
elseif status == :Infeasible
    # oops
elseif status == :Unbounded
    # oops
else
    # Something went wrong
end

```

JuMP 0.19 will contain a much richer status reporting system that will make this a whole lot easier.

---

<div class="post-metadata">

**Author:** ![shoshievass](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shoshievass/32/3260_2.png) [@shoshievass](https://discourse.julialang.org/u/shoshievass)\
**Post date:** [August 16, 2018, 8:58pm UTC](https://discourse.julialang.org/t/error-handling-in-jump/13584/3 "2018-08-16T20:58:03Z")

</div>

Thank you!
