tweaking error handler to throw up error code