Comparing version 4.7.1 to 4.8.0
# Changelog | ||
## 4.8.0 (2023-09-15) | ||
Full Changelog: [v4.7.1...v4.8.0](https://github.com/openai/openai-node/compare/v4.7.1...v4.8.0) | ||
### Features | ||
* **errors:** add status code to error message ([#315](https://github.com/openai/openai-node/issues/315)) ([9341219](https://github.com/openai/openai-node/commit/93412197c67cb3fb203f35e3ae0a7c3fb173453e)) | ||
## 4.7.1 (2023-09-15) | ||
@@ -4,0 +12,0 @@ |
@@ -349,3 +349,3 @@ 'use strict'; | ||
} | ||
const errText = await response.text().catch(() => 'Unknown'); | ||
const errText = await response.text().catch((e) => (0, exports.castToError)(e).message); | ||
const errJSON = (0, exports.safeJSON)(errText); | ||
@@ -352,0 +352,0 @@ const errMessage = errJSON ? undefined : errText; |
@@ -20,3 +20,3 @@ 'use strict'; | ||
constructor(status, error, message, headers) { | ||
super(APIError.makeMessage(error, message)); | ||
super(`${status} ${APIError.makeMessage(error, message)}`); | ||
this.status = status; | ||
@@ -38,3 +38,3 @@ this.headers = headers; | ||
: error ? JSON.stringify(error) | ||
: message || 'Unknown error occurred' | ||
: message || 'status code (no body)' | ||
); | ||
@@ -41,0 +41,0 @@ } |
{ | ||
"name": "openai", | ||
"version": "4.7.1", | ||
"version": "4.8.0", | ||
"description": "Client library for the OpenAI API", | ||
@@ -5,0 +5,0 @@ "author": "OpenAI <support@openai.com>", |
@@ -380,3 +380,3 @@ import { VERSION } from './version.js'; | ||
const errText = await response.text().catch(() => 'Unknown'); | ||
const errText = await response.text().catch((e) => castToError(e).message); | ||
const errJSON = safeJSON(errText); | ||
@@ -383,0 +383,0 @@ const errMessage = errJSON ? undefined : errText; |
@@ -20,3 +20,3 @@ // File generated from our OpenAPI spec by Stainless. | ||
) { | ||
super(APIError.makeMessage(error, message)); | ||
super(`${status} ${APIError.makeMessage(error, message)}`); | ||
this.status = status; | ||
@@ -38,3 +38,3 @@ this.headers = headers; | ||
: error ? JSON.stringify(error) | ||
: message || 'Unknown error occurred' | ||
: message || 'status code (no body)' | ||
); | ||
@@ -41,0 +41,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '4.7.1'; // x-release-please-version | ||
export const VERSION = '4.8.0'; // x-release-please-version |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = '4.7.1'; | ||
export declare const VERSION = '4.8.0'; | ||
//# sourceMappingURL=version.d.ts.map |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '4.7.1'; // x-release-please-version | ||
exports.VERSION = '4.8.0'; // x-release-please-version | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
663429