From 5ae1f711c6932d6868b931f770931249975b4761 Mon Sep 17 00:00:00 2001 From: MinUk Song Date: Fri, 14 Jun 2024 13:58:00 -0700 Subject: [PATCH] fix: typo --- lib/cli-create.ts | 4 ++-- lib/cli-list.ts | 6 +++--- lib/cli-merge.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cli-create.ts b/lib/cli-create.ts index 8916775..a102f83 100644 --- a/lib/cli-create.ts +++ b/lib/cli-create.ts @@ -36,9 +36,9 @@ export async function createAction(options: CreateOptions) { if (response instanceof AxiosError) { throw response; } - if (response.status / 100 === 2) { + if (response.status / 100 !== 2) { console.error(`Failed to create merge request: ${JSON.stringify(response.data)}, Status ${response.status}`); - throw new Error(`Failed to accept merge request`); + process.exit(1); } console.log(JSON.stringify(response.data)); } diff --git a/lib/cli-list.ts b/lib/cli-list.ts index c28991d..f7eb14c 100644 --- a/lib/cli-list.ts +++ b/lib/cli-list.ts @@ -32,9 +32,9 @@ export async function listAction(options: ListOptions) { if (response instanceof AxiosError) { throw response; } - if (response.status / 100 === 2) { - console.error(`Failed to create merge request: ${JSON.stringify(response.data)}, Status ${response.status}`); - throw new Error(`Failed to accept merge request`); + if (response.status / 100 !== 2) { + console.error(`Failed to list merge requests: ${JSON.stringify(response.data)}, Status ${response.status}`); + process.exit(1); } console.log(JSON.stringify(response.data)); } diff --git a/lib/cli-merge.ts b/lib/cli-merge.ts index 4f94c17..5e5a0de 100644 --- a/lib/cli-merge.ts +++ b/lib/cli-merge.ts @@ -33,9 +33,9 @@ export async function mergeAction(options: AcceptOptions) { if (response instanceof AxiosError) { throw response; } - if (response.status / 100 === 2) { + if (response.status / 100 !== 2) { console.error(`Failed to accept merge request: ${JSON.stringify(response.data)}, Status ${response.status}`); - throw new Error(`Failed to accept merge request`); + process.exit(1); } console.log(`Merge request ${mergeRequestIid} is accepted`); }