Handle exceptions thrown in parallel regions
I was assuming that exceptions aren't thrown inside of parallel regions because IIRC OpenMP doesn't handle that properly. However, it looks like there is the possibility of
bad_alloc expections being thrown by the workspace allocations.
This will propagate the exception to python instead of terminating the whole process.