From fe7a839b146effb58b5bf3c316a95b6d30e512a8 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Sun, 15 Oct 2023 12:57:59 -0700 Subject: [PATCH] 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 --- desktop/flipper-ui-browser/src/index.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/desktop/flipper-ui-browser/src/index.tsx b/desktop/flipper-ui-browser/src/index.tsx index ec80cf002..26ee55d70 100644 --- a/desktop/flipper-ui-browser/src/index.tsx +++ b/desktop/flipper-ui-browser/src/index.tsx @@ -42,9 +42,16 @@ async function start() { console.info( '[flipper-client][ui-browser] Get token from manifest instead', ); - const manifestResponse = await fetch('manifest.json'); - const manifest = await manifestResponse.json(); - token = manifest.token; + try { + const manifestResponse = await fetch('manifest.json'); + 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(