Allow exception handler to be provided.