python – Trapping UserWarnings from solve_ivp in scipy (solving ODEs)

I discovered the odeint in python scpiy is very sensitive to the number of output points you request which is not great. So I switched to the newer solve_ivp method and its behaves better. However is there a way to trap “Userwarnings” that come from the method when the ODE model is bad, eg “lsoda: Repeated error test failures (internal error).” I’m running 1000s of models through the method and I want to filter out those models that are not solvable. I need however to be able to detect when the solver is having problems so I can mark that model as bad. I was hoping solve_ivp would issue exceptions but it doesn’t. Is there a way to detect when solve_ivp is having numerical difficulties?