Skip to content

Commit

Permalink
Issue #173: More descriptive error message when creating/deploying an…
Browse files Browse the repository at this point in the history
…other users app

Signed-off-by: macdonst <[email protected]>
  • Loading branch information
macdonst committed Jan 16, 2024
1 parent 10f3f1f commit b3a45fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/commands/create/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = async function action (params, utils) {
}
catch (err) {
if (err.message === 'app_not_found') return Error(`No app found with app ID '${appID}'`)
if (err.message === 'unknown_error') return Error(`No app found with app ID '${appID}' or the user does not have permission to access the app.`)
return
}
let envs = app.environments
Expand Down
9 changes: 8 additions & 1 deletion src/commands/deploy/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ module.exports = async function action (params, utils) {

// Go get the app (if we didn't just create one)
if (!app) {
app = await client.find({ token, appID, _staging })
try {
app = await client.find({ token, appID, _staging })
}
catch (err) {
if (err.message === 'app_not_found') return Error(`No app found with app ID '${appID}'`)
if (err.message === 'unknown_error') return Error(`No app found with app ID '${appID}' or the user does not have permission to access the app.`)
return
}
}

let envs = app.environments
Expand Down

0 comments on commit b3a45fc

Please sign in to comment.