wrap openid-config request in try/catch
This commit is contained in:
parent
555c615711
commit
017bb0d146
1 changed files with 11 additions and 7 deletions
|
@ -9,13 +9,17 @@ async function getFxaConfig() {
|
|||
if (fxaConfig && Date.now() - lastConfigRefresh < 1000 * 60 * 5) {
|
||||
return fxaConfig;
|
||||
}
|
||||
const res = await fetch(
|
||||
`${config.fxa_url}/.well-known/openid-configuration`,
|
||||
{ timeout: 3000 }
|
||||
);
|
||||
fxaConfig = await res.json();
|
||||
fxaConfig.key_scope = KEY_SCOPE;
|
||||
lastConfigRefresh = Date.now();
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${config.fxa_url}/.well-known/openid-configuration`,
|
||||
{ timeout: 3000 }
|
||||
);
|
||||
fxaConfig = await res.json();
|
||||
fxaConfig.key_scope = KEY_SCOPE;
|
||||
lastConfigRefresh = Date.now();
|
||||
} catch (e) {
|
||||
// continue with previous fxaConfig
|
||||
}
|
||||
return fxaConfig;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue