improve custom error class