refine remote error handling