@gitbeaker/rest 39.26.2 → 39.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -339,17 +339,26 @@ const api = new Gitlab({
339
339
 
340
340
  Request errors are returned back within a plain Error instance, using the cause to hold the original response and a text description of the error pulled from the response's error or message fields if JSON, or its plain text value:
341
341
 
342
- ```js
343
- Error: Bad Request
344
- <stack trace>
345
- {
346
- [cause]: {
347
- description: <text description>,
348
- response: <original Response object>
342
+ ```ts
343
+ class GitbeakerError extends Error {
344
+ constructor(
345
+ message: string,
346
+ options?: {
347
+ cause: {
348
+ description: string;
349
+ request: Request;
350
+ response: Response;
351
+ };
352
+ },
353
+ ) {
354
+ super(message, options);
355
+ this.name = 'GitbeakerError';
349
356
  }
350
357
  }
351
358
  ```
352
359
 
360
+ Note, the message is assigned to the Response's `statusText`, and the [Request](https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#request) and [Response](https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#response) types are from the NodeJS API.
361
+
353
362
  ## Examples
354
363
 
355
364
  Once you have your library instantiated, you can utilize many of the API's functionality:
@@ -514,6 +523,7 @@ projectsAPI.create({
514
523
  <tr>
515
524
  <td align="center" valign="top" width="3.84%"><a href="https://github.com/domharrington"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/848223?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Dom Harrington"/></td>
516
525
  <td align="center" valign="top" width="3.84%"><a href="https://github.com/kseino"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/1378066?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Kohei Seino"/></td>
526
+ <td align="center" valign="top" width="3.84%"><a href="https://www.1stg.me/"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/8336744?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="JounQin"/></td>
517
527
  </tr>
518
528
  </p>
519
529
 
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ async function throwFailedRequestError(request, response) {
72
72
  } else {
73
73
  description = content;
74
74
  }
75
- throw new Error(response.statusText, {
75
+ throw new requesterUtils.GitbeakerRequestError(response.statusText, {
76
76
  cause: {
77
77
  description,
78
78
  request,
@@ -101,7 +101,7 @@ async function defaultRequestHandler(endpoint, options) {
101
101
  await endpointRateLimit();
102
102
  const response = await fetch(request).catch((e) => {
103
103
  if (e.name === "TimeoutError" || e.name === "AbortError") {
104
- throw new Error("Query timeout was reached");
104
+ throw new requesterUtils.GitbeakerTimeoutError("Query timeout was reached");
105
105
  }
106
106
  throw e;
107
107
  });
@@ -112,7 +112,7 @@ async function defaultRequestHandler(endpoint, options) {
112
112
  await delay(2 ** i * 0.25);
113
113
  continue;
114
114
  }
115
- throw new Error(
115
+ throw new requesterUtils.GitbeakerRetryError(
116
116
  `Could not successfully complete this request due to Error 429. Check the applicable rate limits for this endpoint.`
117
117
  );
118
118
  }
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Resources from '@gitbeaker/core';
2
- import { createRequesterFn, presetResourceArguments, getMatchingRateLimiter } from '@gitbeaker/requester-utils';
2
+ import { createRequesterFn, presetResourceArguments, getMatchingRateLimiter, GitbeakerTimeoutError, GitbeakerRetryError, GitbeakerRequestError } from '@gitbeaker/requester-utils';
3
3
 
4
4
  // src/index.ts
5
5
  async function defaultOptionsHandler(resourceOptions, requestOptions) {
@@ -50,7 +50,7 @@ async function throwFailedRequestError(request, response) {
50
50
  } else {
51
51
  description = content;
52
52
  }
53
- throw new Error(response.statusText, {
53
+ throw new GitbeakerRequestError(response.statusText, {
54
54
  cause: {
55
55
  description,
56
56
  request,
@@ -79,7 +79,7 @@ async function defaultRequestHandler(endpoint, options) {
79
79
  await endpointRateLimit();
80
80
  const response = await fetch(request).catch((e) => {
81
81
  if (e.name === "TimeoutError" || e.name === "AbortError") {
82
- throw new Error("Query timeout was reached");
82
+ throw new GitbeakerTimeoutError("Query timeout was reached");
83
83
  }
84
84
  throw e;
85
85
  });
@@ -90,7 +90,7 @@ async function defaultRequestHandler(endpoint, options) {
90
90
  await delay(2 ** i * 0.25);
91
91
  continue;
92
92
  }
93
- throw new Error(
93
+ throw new GitbeakerRetryError(
94
94
  `Could not successfully complete this request due to Error 429. Check the applicable rate limits for this endpoint.`
95
95
  );
96
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitbeaker/rest",
3
- "version": "39.26.2",
3
+ "version": "39.27.1",
4
4
  "description": "Cross Platform implementation of the GitLab API",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -56,8 +56,8 @@
56
56
  "release": "auto shipit"
57
57
  },
58
58
  "dependencies": {
59
- "@gitbeaker/core": "^39.26.2",
60
- "@gitbeaker/requester-utils": "^39.26.2"
59
+ "@gitbeaker/core": "^39.27.1",
60
+ "@gitbeaker/requester-utils": "^39.27.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@playwright/test": "^1.40.1",
@@ -65,5 +65,5 @@
65
65
  "tsup": "^8.0.1",
66
66
  "typescript": "^5.3.3"
67
67
  },
68
- "gitHead": "52ef0e622de304d98afb811f4937560edefd8889"
68
+ "gitHead": "4de10dcc0b1ecb50c47d8d5088b9dd28ebf7ab92"
69
69
  }