@forge/kvs
1.5.1-next.01.6.0-next.1
out/storage-api.js~
out/storage-api.jsModified+6−6
Index: package/out/storage-api.js
===================================================================
--- package/out/storage-api.js
+++ package/out/storage-api.js
@@ -117,9 +117,13 @@
'content-type': 'application/json'
}
};
const response = await this.apiClient(path, requestBody);
- await (0, error_handling_1.checkResponseError)(response);
+ const requestContext = {
+ httpMethod: requestBody.method,
+ httpPath: path
+ };
+ await (0, error_handling_1.checkResponseError)(response, requestContext);
if (responseType === ResponseType.NONE) {
return;
}
const responseText = await response.text();
@@ -127,13 +131,9 @@
return undefined;
}
const parsedBody = (0, error_handling_1.safeGetParsedBody)(responseText);
if (parsedBody === undefined) {
- const details = {
- status: response.status,
- statusText: response.statusText,
- traceId: (0, error_handling_1.extractTraceId)(response)
- };
+ const details = (0, error_handling_1.getAPIErrorResponseDetails)(response, responseText, requestContext);
throw new errors_1.ForgeKvsAPIError(details, {
code: 'UNKNOWN_ERROR',
message: 'Unexpected error in Forge KVS API. Response was not valid JSON',
context: { contentLength: response.headers.get('content-length') }