return error.code if exists