Skip to content

Commit

Permalink
Release: v4.0.0 (#312)
Browse files Browse the repository at this point in the history
* Dependencies updated

* add rate limiting headers to error response (#309)

Signed-off-by: Chalenge Masekera <[email protected]>

* Agile endpoints updated

* feat: Adds new HttpException class which will be return instead of th… (#308)

* feat: Adds new HttpException class which will be return instead of the plain object in case of error.

* feat: Adds new HttpException class which will be return instead of the plain object in case of error.

* feat: Adds new HttpException class which will be return instead of the plain object in case of error.

* feat: Adds new HttpException class which will be return instead of the plain object in case of error.

* feat: Adds new HttpException class which will be return instead of the plain object in case of error.

* README updated

* CHANGELOG updated

* CHANGELOG updated

* CHANGELOG updated

* Self code-review

---------

Signed-off-by: Chalenge Masekera <[email protected]>
Co-authored-by: Chalenge Masekera <[email protected]>
Co-authored-by: Dmitry Shilov <[email protected]>
  • Loading branch information
3 people authored May 17, 2024
1 parent 7d88a1b commit 4220e51
Show file tree
Hide file tree
Showing 83 changed files with 2,298 additions and 941 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: ci
on: push
name: CI

on:
push:
repository_dispatch:
types: [ pr-approved ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ jobs:
path: ./CHANGELOG.md
- name: Parse Changelog Entry
run: |
CHANGELOG_CONTENT=$(echo '${{ steps.changelog.outputs.content }}' | awk '/### ${{ steps.pkg.outputs.version }}/,/### /{print; if (/### / && !/### ${{ steps.pkg.outputs.version }}/){exit}}')
CHANGELOG_CONTENT=$(awk '/^### [0-9]+\.[0-9]+\.[0-9]+/ {if (p) exit; p=1} p' CHANGELOG.md)
echo "CHANGELOG=$CHANGELOG_CONTENT" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Jira.js changelog

### 4.0.0

- [**#309**](https://github.com/MrRefactoring/jira.js/pull/309) - Added rate limiting headers. Thanks to [Chalenge Masekera](https://github.com/chalenge).
- [**#308**](https://github.com/MrRefactoring/jira.js/pull/308) - Implemented a new error handling mechanism. Thanks to [Dmitry Shilov](https://github.com/bk201-).

#### Breaking changes

- The new error handling mechanism may affect your library usage.

### 3.0.5

- Dependencies updated
Expand Down
42 changes: 36 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Usability, consistency, and performance are key focuses of jira.js, and it also
- [Basic](#basic-authentication)
- [OAuth 2.0](#oauth-20)
- [Personal access token](#personal-access-token)
- [Error handling](#error-handling)
- [Example and using algorithm](#example-and-using-algorithm)
- [Decreasing Webpack bundle size](#decreasing-webpack-bundle-size)
- [Take a look at our other products](#take-a-look-at-our-other-products)
Expand Down Expand Up @@ -123,6 +124,34 @@ const client = new Version3Client({
});
```

#### Error handling
Starting from version 4.0.0, the library has a new error handling system.
Now, all errors are instances of
- the `HttpException` class in case the Axios has response from the server;
- the `AxiosError` class in case something went wrong before sending the request.

The `HttpException` class tries to parse different sorts of responses from the server to provide a unified error class.

If the original error is required, you can get it from the `cause` property of the `HttpException` class.

```typescript
try {
const users = await this.client.userSearch.findUsers({ query: email });
// ...
} catch (error: uknown) {
if (error instanceof HttpException) {
console.log(error.message);
console.log(error.cause); // original error (AxiosError | Error)
console.log(error.cause.response?.headers); // headers from the server
} else if (error instanceof AxiosError) {
console.log(error.message);
console.log(error.code); // error code, for instance AxiosError.ETIMEDOUT
} else {
console.log(error);
}
}
````

#### Example and using algorithm

1. Example
Expand Down Expand Up @@ -197,16 +226,17 @@ Available groups:

- [backlog](https://developer.atlassian.com/cloud/jira/software/rest/api-group-backlog/#api-group-backlog)
- [board](https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-group-board)
- [epic](https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-group-epic)
- [issue](https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-group-issue)
- [sprint](https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-group-sprint)
- [builds](https://developer.atlassian.com/cloud/jira/software/rest/api-group-builds/#api-group-builds)
- [deployments](https://developer.atlassian.com/cloud/jira/software/rest/api-group-deployments/#api-group-deployments)
- [developmentInformation](https://developer.atlassian.com/cloud/jira/software/rest/api-group-development-information/#api-group-development-information)
- [devopsComponents](https://developer.atlassian.com/cloud/jira/software/rest/api-group-devops-components/#api-group-devops-components)
- [epic](https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-group-epic)
- [featureFlags](https://developer.atlassian.com/cloud/jira/software/rest/api-group-feature-flags/#api-group-feature-flags)
- [deployments](https://developer.atlassian.com/cloud/jira/software/rest/api-group-deployments/#api-group-deployments)
- [builds](https://developer.atlassian.com/cloud/jira/software/rest/api-group-builds/#api-group-builds)
- [issue](https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-group-issue)
- [operations](https://developer.atlassian.com/cloud/jira/software/rest/api-group-operations/#api-group-operations)
- [remoteLinks](https://developer.atlassian.com/cloud/jira/software/rest/api-group-remote-links/#api-group-remote-links)
- [securityInformation](https://developer.atlassian.com/cloud/jira/software/rest/api-group-security-information/#api-group-security-information)
- [otherOperations](https://developer.atlassian.com/cloud/jira/software/rest/api-group-other-operations/#api-group-other-operations)
- [sprint](https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-group-sprint)
</details>
<details>
<summary>Version 2 Cloud REST API group</summary>
Expand Down
44 changes: 22 additions & 22 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"license": "MIT",
"devDependencies": {
"@types/node": "^20.11.20",
"@types/node": "^20.12.12",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
"typescript": "^5.4.5"
},
"dependencies": {
"jira.js": "latest"
Expand Down
Loading

0 comments on commit 4220e51

Please sign in to comment.