Return actual error code in failure state