throw custom error before generic error