Question: How to "catch" warning messages from a procedure.

with(Optimization):
expr_optimize := fSW__Ratio_Tol[XU5]*f_ratio__SpreadSpectrum[XU5]*(R34^2*k1__RT[XU5] + R34*k2__RT[XU5] + k3__RT[XU5])/R34^2;
seqUnknownRanges := R34 = 5.640*10^4*Unit('Omega') .. 6.160*10^4*Unit('Omega'), k1__RT[XU5] = 4.054*10^4*Unit(1/('s')) .. 4.054*10^4*Unit(1/('s')), k2__RT[XU5] = 1.593*10^11*Unit(1/('F')) .. 1.593*10^11*Unit(1/('F')), k3__RT[XU5] = -2.645*10^15*Unit('m'^4*'kg'^2/('s'^7*'A'^4)) .. -2.645*10^15*Unit('m'^4*'kg'^2/('s'^7*'A'^4)), fSW__Ratio_Tol[XU5] = 0.950 .. 1.050, f_ratio__SpreadSpectrum[XU5] = 1 .. 1.250;
NLPSolve(expr_optimize, seqUnknownRanges, 'useunits', 'method' = 'modifiednewton', 'optimalitytolerance' = 0.101);

NLPSolve returns this message "Warning, convergence is not assured; examine Hessian values, or consider raising tolerance"

How can I capture this message in a procedure and take appropriate action?

Please Wait...