Skip to content

Commit

Permalink
fix: error handling for HTTP status 422
Browse files Browse the repository at this point in the history
Added error handling for HTTP status 422 in API responses, returning a descriptive QaseError with relevant details.
  • Loading branch information
gibiw committed Nov 26, 2024
1 parent 65450e1 commit 5948a38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions qase-javascript-commons/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## What's new

Added error handling for HTTP status 422 in API responses, returning a descriptive QaseError with relevant details.

# [email protected]

## What's new

Use the API v2 client by default. If you want to use the API v1 client, specify the `useV2` option in the config file or
the environment variable `QASE_TESTOPS_USEV2` as `False`.

Expand Down
2 changes: 1 addition & 1 deletion qase-javascript-commons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qase-javascript-commons",
"version": "2.2.5",
"version": "2.2.6",
"description": "Qase JS Reporters",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion qase-javascript-commons/src/reporters/testops-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ export class TestOpsReporter extends AbstractReporter {
return new QaseError(message + ': Not found.');
}

if (error.response?.status === 400) {
if (error.response?.status === 400 || error.response?.status === 422) {
return new QaseError(message + ': Bad request. Body: \n ' + JSON.stringify(model));
}

Expand Down

0 comments on commit 5948a38

Please sign in to comment.