diff --git a/src/cli/domain/registry.ts b/src/cli/domain/registry.ts index 9c49c830e..ecca72a3c 100644 --- a/src/cli/domain/registry.ts +++ b/src/cli/domain/registry.ts @@ -107,7 +107,7 @@ export default function registry(opts: RegistryOptions = {}) { try { await put(options.route, options.path, requestsHeaders); } catch (err) { - let parsedError = (err as any).response.body || (err as any); + let parsedError = err as any; let errMsg = ''; if (!parsedError || typeof parsedError !== 'object') { try { diff --git a/src/utils/put.ts b/src/utils/put.ts index 4c2e4d11b..0374b8a89 100644 --- a/src/utils/put.ts +++ b/src/utils/put.ts @@ -25,11 +25,12 @@ async function put( body: form }); + const response = await res.body.text(); if (res.statusCode !== 200) { - throw res.body.text(); + throw response; } - return res.body.text(); + return response; } export default put;