Make sure you throw with the right error code