Refine error handling.