Skip to content

Commit 7a6a49f

Browse files
philnashdkundel
authored andcommitted
fix(twilio-run:promote): better error message for 409 error
Fixes #171.
1 parent d1c812b commit 7a6a49f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/twilio-run/src/commands/activate.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
sharedCliOptions,
2222
} from './shared';
2323
import { CliInfo } from './types';
24+
import { ClientApiError } from '@twilio-labs/serverless-api/dist/utils/error';
2425

2526
const debug = getDebugFunction('twilio-run:activate');
2627

@@ -33,7 +34,12 @@ function handleError(err: Error, spinner: Ora) {
3334
if (spinner) {
3435
if (err.name === 'TwilioApiError') {
3536
spinner.fail('Failed promoting build.');
36-
logApiError(logger, err);
37+
const clientApiError = err as ClientApiError;
38+
if (clientApiError.code === 20409) {
39+
clientApiError.message +=
40+
'\n\nThis is probably because you are trying to promote a build to an environment where it is already live. Try promoting the build to a different environment or choosing a different build to promote to this environment.';
41+
}
42+
logApiError(logger, clientApiError);
3743
} else {
3844
spinner.fail(err.message);
3945
}

0 commit comments

Comments
 (0)