#1499 Fix the issue of uncaught exception in Petsc SNESSolve
If an exception was thrown during the SNESSolve call, there was a libc++ abi incompatibility that resulted in uncaught exception.
So now in the functions given to SNES, we must catch the exceptions, display the what() message and just return -1 instead of 0.