print error before throwing