[master][PATCH] Allow catching exceptions from threads