Skip to content

Commit 4220e51

Browse files
MrRefactoringchalengebk201-
authored
Release: v4.0.0 (#312)
* 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]>
1 parent 7d88a1b commit 4220e51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2298
-941
lines changed

.github/workflows/ci.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
name: ci
2-
on: push
1+
name: CI
2+
3+
on:
4+
push:
5+
repository_dispatch:
6+
types: [ pr-approved ]
37

48
jobs:
59
build:

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ jobs:
177177
path: ./CHANGELOG.md
178178
- name: Parse Changelog Entry
179179
run: |
180-
CHANGELOG_CONTENT=$(echo '${{ steps.changelog.outputs.content }}' | awk '/### ${{ steps.pkg.outputs.version }}/,/### /{print; if (/### / && !/### ${{ steps.pkg.outputs.version }}/){exit}}')
180+
CHANGELOG_CONTENT=$(awk '/^### [0-9]+\.[0-9]+\.[0-9]+/ {if (p) exit; p=1} p' CHANGELOG.md)
181181
echo "CHANGELOG=$CHANGELOG_CONTENT" >> $GITHUB_ENV
182182
- name: Create GitHub Release
183183
uses: softprops/action-gh-release@v1

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Jira.js changelog
22

3+
### 4.0.0
4+
5+
- [**#309**](https://github.com/MrRefactoring/jira.js/pull/309) - Added rate limiting headers. Thanks to [Chalenge Masekera](https://github.com/chalenge).
6+
- [**#308**](https://github.com/MrRefactoring/jira.js/pull/308) - Implemented a new error handling mechanism. Thanks to [Dmitry Shilov](https://github.com/bk201-).
7+
8+
#### Breaking changes
9+
10+
- The new error handling mechanism may affect your library usage.
11+
312
### 3.0.5
413

514
- Dependencies updated

README.md

+36-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Usability, consistency, and performance are key focuses of jira.js, and it also
2424
- [Basic](#basic-authentication)
2525
- [OAuth 2.0](#oauth-20)
2626
- [Personal access token](#personal-access-token)
27+
- [Error handling](#error-handling)
2728
- [Example and using algorithm](#example-and-using-algorithm)
2829
- [Decreasing Webpack bundle size](#decreasing-webpack-bundle-size)
2930
- [Take a look at our other products](#take-a-look-at-our-other-products)
@@ -123,6 +124,34 @@ const client = new Version3Client({
123124
});
124125
```
125126

127+
#### Error handling
128+
Starting from version 4.0.0, the library has a new error handling system.
129+
Now, all errors are instances of
130+
- the `HttpException` class in case the Axios has response from the server;
131+
- the `AxiosError` class in case something went wrong before sending the request.
132+
133+
The `HttpException` class tries to parse different sorts of responses from the server to provide a unified error class.
134+
135+
If the original error is required, you can get it from the `cause` property of the `HttpException` class.
136+
137+
```typescript
138+
try {
139+
const users = await this.client.userSearch.findUsers({ query: email });
140+
// ...
141+
} catch (error: uknown) {
142+
if (error instanceof HttpException) {
143+
console.log(error.message);
144+
console.log(error.cause); // original error (AxiosError | Error)
145+
console.log(error.cause.response?.headers); // headers from the server
146+
} else if (error instanceof AxiosError) {
147+
console.log(error.message);
148+
console.log(error.code); // error code, for instance AxiosError.ETIMEDOUT
149+
} else {
150+
console.log(error);
151+
}
152+
}
153+
````
154+
126155
#### Example and using algorithm
127156

128157
1. Example
@@ -197,16 +226,17 @@ Available groups:
197226

198227
- [backlog](https://developer.atlassian.com/cloud/jira/software/rest/api-group-backlog/#api-group-backlog)
199228
- [board](https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-group-board)
200-
- [epic](https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-group-epic)
201-
- [issue](https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-group-issue)
202-
- [sprint](https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-group-sprint)
229+
- [builds](https://developer.atlassian.com/cloud/jira/software/rest/api-group-builds/#api-group-builds)
230+
- [deployments](https://developer.atlassian.com/cloud/jira/software/rest/api-group-deployments/#api-group-deployments)
203231
- [developmentInformation](https://developer.atlassian.com/cloud/jira/software/rest/api-group-development-information/#api-group-development-information)
232+
- [devopsComponents](https://developer.atlassian.com/cloud/jira/software/rest/api-group-devops-components/#api-group-devops-components)
233+
- [epic](https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-group-epic)
204234
- [featureFlags](https://developer.atlassian.com/cloud/jira/software/rest/api-group-feature-flags/#api-group-feature-flags)
205-
- [deployments](https://developer.atlassian.com/cloud/jira/software/rest/api-group-deployments/#api-group-deployments)
206-
- [builds](https://developer.atlassian.com/cloud/jira/software/rest/api-group-builds/#api-group-builds)
235+
- [issue](https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-group-issue)
236+
- [operations](https://developer.atlassian.com/cloud/jira/software/rest/api-group-operations/#api-group-operations)
207237
- [remoteLinks](https://developer.atlassian.com/cloud/jira/software/rest/api-group-remote-links/#api-group-remote-links)
208238
- [securityInformation](https://developer.atlassian.com/cloud/jira/software/rest/api-group-security-information/#api-group-security-information)
209-
- [otherOperations](https://developer.atlassian.com/cloud/jira/software/rest/api-group-other-operations/#api-group-other-operations)
239+
- [sprint](https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-group-sprint)
210240
</details>
211241
<details>
212242
<summary>Version 2 Cloud REST API group</summary>

examples/package-lock.json

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
},
1313
"license": "MIT",
1414
"devDependencies": {
15-
"@types/node": "^20.11.20",
15+
"@types/node": "^20.12.12",
1616
"ts-node": "^10.9.2",
17-
"typescript": "^5.3.3"
17+
"typescript": "^5.4.5"
1818
},
1919
"dependencies": {
2020
"jira.js": "latest"

0 commit comments

Comments
 (0)