Skip to content

Commit

Permalink
fix: check status code
Browse files Browse the repository at this point in the history
  • Loading branch information
uanid committed Jun 14, 2024
1 parent 3cea58a commit d02871f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cli-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function createAction(options: CreateOptions) {
if (response instanceof AxiosError) {
throw response;
}
if (response.status !== 200) {
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`);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function listAction(options: ListOptions) {
if (response instanceof AxiosError) {
throw response;
}
if (response.status !== 200) {
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`);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function mergeAction(options: AcceptOptions) {
if (response instanceof AxiosError) {
throw response;
}
if (response.status !== 200) {
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`);
}
Expand Down

0 comments on commit d02871f

Please sign in to comment.