Skip to content

Commit

Permalink
Pass through Chainport error messages from API (#5695)
Browse files Browse the repository at this point in the history
  • Loading branch information
dguenther authored Dec 16, 2024
1 parent 533acb8 commit c40f817
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ironfish-cli/src/utils/chainport/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ const makeChainportRequest = async <T extends object>(url: string): Promise<T> =
})
.catch((error) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const chainportError = error.response?.data?.error?.description as string
if (chainportError) {
throw new Error(chainportError)
const apiError = error.response?.data?.message as string
if (apiError) {
throw new Error('Chainport error: ' + apiError)
} else {
throw new Error('Chainport error - ' + error)
throw new Error('Chainport error: ' + error)
}
})

Expand Down

0 comments on commit c40f817

Please sign in to comment.