Skip to content

Commit

Permalink
feat: use error message from the API [sc-21028]
Browse files Browse the repository at this point in the history
  • Loading branch information
maxigimenez committed Aug 29, 2024
1 parent 1aa6287 commit 4b25caa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/cli/src/commands/env/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ export default class EnvUpdate extends AuthCommand {
await api.environmentVariables.update(envVariableName, envValue, locked, secret)
this.log(`Environment variable ${envVariableName} updated.`)
} catch (err: any) {
if (err?.response?.status === 400 && err?.response?.data?.message) {
throw new Error(err.response.data.message)
}

if (err?.response?.status === 404) {
throw new Error(`Environment variable ${envVariableName} not found.`)
}

throw err
}
}
Expand Down

0 comments on commit 4b25caa

Please sign in to comment.