Skip to content

Commit 9ab3cc9

Browse files
authored
add more specific message for postDeply 403 and 404 (#771)
1 parent d05a7a6 commit 9ab3cc9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/deploy.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,17 @@ export async function deploy(
277277
try {
278278
deployId = await apiClient.postDeploy({projectId: deployTarget.project.id, message});
279279
} catch (error) {
280-
if (isHttpError(error) && (error.statusCode === 404 || error.statusCode === 403)) {
281-
throw new CliError("Deploy failed. Please check your deploy configuration.", {cause: error});
280+
if (isHttpError(error)) {
281+
if (error.statusCode === 404) {
282+
throw new CliError(`Project @${deployTarget.workspace.login}/${deployTarget.project.slug} not found.`, {
283+
cause: error
284+
});
285+
} else if (error.statusCode === 403) {
286+
throw new CliError(
287+
`You don't have permission to deploy to @${deployTarget.workspace.login}/${deployTarget.project.slug}.`,
288+
{cause: error}
289+
);
290+
}
282291
}
283292
throw error;
284293
}

0 commit comments

Comments
 (0)