From 67fa93c3980611a4c43d2c5dca0ea94a44d996ea Mon Sep 17 00:00:00 2001 From: louiszawadzki Date: Tue, 6 Sep 2022 10:30:25 +0200 Subject: [PATCH] Fix non existing deployment error message --- src/commands/codepush/deployment/history.ts | 8 ++++---- test/commands/codepush/deployment/history-test.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/codepush/deployment/history.ts b/src/commands/codepush/deployment/history.ts index a942411b9..8cc84dd16 100644 --- a/src/commands/codepush/deployment/history.ts +++ b/src/commands/codepush/deployment/history.ts @@ -79,16 +79,16 @@ export default class CodePushDeploymentHistoryCommand extends AppCommand { return success(); } catch (error) { debug(`Failed to get list of CodePush deployments - ${inspect(error)}`); - if (error.statusCode === 404) { + if (error.statusCode === 404 && error.response.body === `Deployment "${this.deploymentName}" does not exist.`) { + const deploymentNotExistErrorMsg = `The deployment ${chalk.bold(this.deploymentName)} does not exist.`; + return failure(ErrorCodes.Exception, deploymentNotExistErrorMsg); + } else if (error.statusCode === 404) { const appNotFoundErrorMsg = `The app ${ this.identifier } does not exist. Please double check the name, and provide it in the form owner/appname. \nRun the command ${chalk.bold( `${scriptName} apps list` )} to see what apps you have access to.`; return failure(ErrorCodes.NotFound, appNotFoundErrorMsg); - } else if (error.statusCode === 400) { - const deploymentNotExistErrorMsg = `The deployment ${chalk.bold(this.deploymentName)} does not exist.`; - return failure(ErrorCodes.Exception, deploymentNotExistErrorMsg); } else { return failure(ErrorCodes.Exception, error.response.body); } diff --git a/test/commands/codepush/deployment/history-test.ts b/test/commands/codepush/deployment/history-test.ts index 9cc2ee78c..599f64048 100644 --- a/test/commands/codepush/deployment/history-test.ts +++ b/test/commands/codepush/deployment/history-test.ts @@ -71,7 +71,7 @@ describe("codepush deployment history", () => { .get(`/v0.1/apps/${testData.fakeAppIdentifier}/deployments/${testData.fakeNonExistentDeploymentName}/releases`) .reply((uri, requestBody) => { requestReleasesSpy(); - return [400, {}]; + return [404, `Deployment "${testData.fakeNonExistentDeploymentName}" does not exist.`]; }) .get(`/v0.1/apps/${testData.fakeNonExistentAppIdentifier}/deployments/${testData.fakeDeploymentName}/releases`) .reply((uri, requestBody) => {