diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index c557a2811f..fd5e036b44 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Update error handling on deployment commands (#2108) ## [4.0.4] - 2023-10-17 ### Fixed diff --git a/packages/cli/src/controller/publish-controller.ts b/packages/cli/src/controller/publish-controller.ts index dd8c95efc0..cbc5819b9f 100644 --- a/packages/cli/src/controller/publish-controller.ts +++ b/packages/cli/src/controller/publish-controller.ts @@ -3,7 +3,13 @@ import fs from 'fs'; import path from 'path'; -import {ReaderFactory, IPFS_WRITE_ENDPOINT, isFileReference, validateCommonProjectManifest, mapToObject} from '@subql/common'; +import { + ReaderFactory, + IPFS_WRITE_ENDPOINT, + isFileReference, + validateCommonProjectManifest, + mapToObject, +} from '@subql/common'; import {parseAlgorandProjectManifest} from '@subql/common-algorand'; import {parseCosmosProjectManifest} from '@subql/common-cosmos'; import {parseEthereumProjectManifest} from '@subql/common-ethereum'; diff --git a/packages/cli/src/utils/utils.ts b/packages/cli/src/utils/utils.ts index b5c8b734eb..d9bc5072d5 100644 --- a/packages/cli/src/utils/utils.ts +++ b/packages/cli/src/utils/utils.ts @@ -71,11 +71,11 @@ export async function checkToken(authToken_ENV: string, token_path: string): Pro } export function errorHandle(e: any, msg: string): Error { - if (axios.isAxiosError(e) as any) { + if ((axios.isAxiosError(e) as any) && e?.response?.data) { throw new Error(`${msg} ${e.response.data.message}`); - } else { - throw new Error(`${msg} ${e.message}`); } + + throw new Error(`${msg} ${e.message}`); } export function buildProjectKey(org: string, projectName: string): string { diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index be750250f8..9afbb2aaa4 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -5,7 +5,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - ## [3.0.7] - 2023-10-17 ### Changed - Update with node-core 6.0.3