When using the Krylov solver
solver = KrylovSolver('gmres', 'ilu')
solver.parameters['relative_tolerance'] = 1.0e-13
solver.parameters['absolute_tolerance'] = 0.0
solver.parameters['maximum_iterations'] = 100
solver.set_operator(A)
u = Function(self.V)
solver.solve(u.vector(), b)
it doesn't fail on nonconvergence; it rather prints a warning on screen
*** Warning: Krylov solver did not converge in 100 iterations (PETSc reason DIVERGED_ITS, residual norm ||r|| = 4.626070e+04).
that is easy to miss if there a lot of output.
How can I make this an error/exception?