TokenProvider can fail if the server is offline

Summary: If the server is offline, the fetch request will fail and this was not properly handled.

Reviewed By: antonk52

Differential Revision: D50299455

fbshipit-source-id: dab8336dedaf93db049dc703a23f9e33935212be
This commit is contained in:
Lorenzo Blasa
2023-10-15 12:57:59 -07:00
committed by Facebook GitHub Bot
parent d40ccc8786
commit fe7a839b14

View File

@@ -42,9 +42,16 @@ async function start() {
console.info( console.info(
'[flipper-client][ui-browser] Get token from manifest instead', '[flipper-client][ui-browser] Get token from manifest instead',
); );
const manifestResponse = await fetch('manifest.json'); try {
const manifest = await manifestResponse.json(); const manifestResponse = await fetch('manifest.json');
token = manifest.token; const manifest = await manifestResponse.json();
token = manifest.token;
} catch (e) {
console.warn(
'[flipper-client][ui-browser] Failed to get token from manifest. Error:',
e.message,
);
}
} }
console.info( console.info(