oauth2-cli 2.0.0 → 2.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [2.0.1](https://github.com/battis/oauth2-cli/compare/oauth2-cli/2.0.0...oauth2-cli/2.0.1) (2026-03-27)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * more detail on bad response ([8a38bd5](https://github.com/battis/oauth2-cli/commit/8a38bd5b86802e0640592117a21d69323a265d8f))
11
+
5
12
  ## [2.0.0](https://github.com/battis/oauth2-cli/compare/oauth2-cli/1.2.8...oauth2-cli/2.0.0) (2026-03-22)
6
13
 
7
14
 
package/README.md CHANGED
@@ -33,7 +33,7 @@ const client = new Client({
33
33
  storage: new FileStorage('/path/to/token/file.json');
34
34
  });
35
35
  console.log(
36
- client.fetchJSON<ExpectedResponse>('https://example.com/path/to/api/endpoint')
36
+ client.fetch<ExpectedResponse>('https://example.com/path/to/api/endpoint')
37
37
  );
38
38
  ```
39
39
 
package/dist/Client.js CHANGED
@@ -331,8 +331,23 @@ export class Client extends EventEmitter {
331
331
  * `PaginatedCollection<T>`
332
332
  */
333
333
  async request(url, method = 'GET', body, headers = {}, dPoPOptions) {
334
- const response = await this.requestRaw(url, method, body, headers, dPoPOptions);
335
- return await this.processResponse(response);
334
+ try {
335
+ const response = await this.requestRaw(url, method, body, headers, dPoPOptions);
336
+ return await this.processResponse(response);
337
+ }
338
+ catch (error) {
339
+ throw new Error(`Bad response from ${this.name}`, {
340
+ cause: {
341
+ request: {
342
+ method,
343
+ url: requestish.URL.toString(url),
344
+ headers: Object.fromEntries(requestish.Headers.from(headers).entries()),
345
+ body
346
+ },
347
+ error
348
+ }
349
+ });
350
+ }
336
351
  }
337
352
  /**
338
353
  * Request a protected resource using the client's access token.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth2-cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Acquire API access tokens via OAuth 2.0 / OpenID Connect within CLI tools",
5
5
  "homepage": "https://github.com/battis/oauth2-cli/tree/main/packages/oauth2-cli#readme",
6
6
  "repository": {
@@ -23,8 +23,8 @@
23
23
  "open": "^11.0.0",
24
24
  "openid-client": "^6.8.2",
25
25
  "ora": "^9.3.0",
26
- "requestish": "0.1.12",
27
- "gcrtl": "0.1.12"
26
+ "gcrtl": "0.1.12",
27
+ "requestish": "0.1.12"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@battis/typescript-tricks": "^0.8.1",