1
0
Fork 0
mirror of synced 2026-06-05 14:35:14 +00:00

fix bug where status code was not being preserved

This commit is contained in:
Varun Sharma 2025-09-06 11:34:53 -07:00
commit d11f2c1d65
3 changed files with 14 additions and 4 deletions

7
dist/pre/index.js vendored
View file

@ -87842,7 +87842,12 @@ function fetchPolicy(owner, policyName, idToken) {
yield sleep(1000);
}
if (response === undefined && err !== undefined) {
throw new Error(`[Policy Fetch] ${err}`);
// Preserve the original error's statusCode if it exists
const error = new Error(`[Policy Fetch] ${err}`);
if (err.statusCode !== undefined) {
error.statusCode = err.statusCode;
}
throw error;
}
else {
return response.result;

File diff suppressed because one or more lines are too long

View file

@ -39,7 +39,12 @@ export async function fetchPolicy(
}
if (response === undefined && err !== undefined) {
throw new Error(`[Policy Fetch] ${err}`);
// Preserve the original error's statusCode if it exists
const error = new Error(`[Policy Fetch] ${err}`);
if (err.statusCode !== undefined) {
(error as any).statusCode = err.statusCode;
}
throw error;
} else {
return response.result;
}
@ -70,7 +75,7 @@ export function mergeConfigs(
return localConfig;
}
function sleep(ms) {
function sleep(ms: number) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});