Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #33 from argos-ci/oliviertassinari-patch-1
Browse files Browse the repository at this point in the history
Improve fail error message
  • Loading branch information
oliviertassinari authored Nov 25, 2020
2 parents 140e3ba + 8520ba5 commit e779923
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ program

try {
const res = await cancel({ ...command })
json = await res.json()
try {
json = await res.json()
} catch (error) {
throw new Error(`Failed to parse response body as JSON:\n\n${await res.text()}`)
}

if (json.error) {
throw new CancelError(json.error.message)
Expand Down

0 comments on commit e779923

Please sign in to comment.