Skip to content

Commit

Permalink
Update deploy errorHandler (#2108)
Browse files Browse the repository at this point in the history
* error handle on generate command

* update error handle on cli deployment commands

* update changelog

* add catches

* trigger node
  • Loading branch information
bz888 authored Oct 18, 2023
1 parent eae4f73 commit 3c9c26c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion packages/cli/src/controller/publish-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c9c26c

Please sign in to comment.