extract into error class