fix bug where status code was not being preserved
This commit is contained in:
parent
b3fc98e4df
commit
d11f2c1d65
3 changed files with 14 additions and 4 deletions
7
dist/pre/index.js
vendored
7
dist/pre/index.js
vendored
|
|
@ -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;
|
||||
|
|
|
|||
2
dist/pre/index.js.map
vendored
2
dist/pre/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue