Use more explicit exception handler for #526