@tscircuit/parts-engine 0.0.24 → 0.0.25
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/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11282,12 +11282,18 @@ var getFetchWithEasyEdaProxy = ({
|
|
|
11282
11282
|
const proxyRequestBody = METHODS_WITHOUT_BODY.has(
|
|
11283
11283
|
mergedTargetRequest.method
|
|
11284
11284
|
) ? void 0 : await mergedTargetRequest.clone().arrayBuffer();
|
|
11285
|
-
|
|
11285
|
+
const response = await upstreamFetch(easyEdaProxyConfig.proxyEndpointUrl, {
|
|
11286
11286
|
method: mergedTargetRequest.method,
|
|
11287
11287
|
headers: proxyRequestHeaders,
|
|
11288
11288
|
body: proxyRequestBody,
|
|
11289
11289
|
signal: requestInit?.signal
|
|
11290
11290
|
});
|
|
11291
|
+
if (response.status === 401) {
|
|
11292
|
+
const proxyErrorResponse = await response.json().catch(() => null);
|
|
11293
|
+
const errorCode = typeof proxyErrorResponse === "object" && proxyErrorResponse !== null && "error_code" in proxyErrorResponse && typeof proxyErrorResponse.error_code === "string" ? proxyErrorResponse.error_code : "unauthorized";
|
|
11294
|
+
throw new Error(`EasyEDA proxy request failed: ${errorCode} (HTTP 401)`);
|
|
11295
|
+
}
|
|
11296
|
+
return response;
|
|
11291
11297
|
};
|
|
11292
11298
|
};
|
|
11293
11299
|
|