refine error type