From 225227199543ec70c24d72d6ebc3b280a4806952 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Mon, 29 Jun 2020 11:18:06 +0200 Subject: [PATCH] Handle problems fetching keys --- assets/scripts.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/assets/scripts.js b/assets/scripts.js index 4bccafe..ee9bf9f 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -181,9 +181,17 @@ async function verifyProofs(opts) { } async function displayProfile(opts) { - let keyData = await fetchKeys(opts); + let keyData, feedback = "", notation, isVerified, verifications = []; + try { + keyData = await fetchKeys(opts); + } catch (e) { + feedback += `

There was a problem fetching the keys.

`; + feedback += `${e}`; + document.body.querySelector('#profileData').innerHTML = feedback; + document.body.querySelector('#profileName').innerHTML = "Could not load profile"; + return; + } let userData = keyData.user.user.userId; - let feedback = "", notation, isVerified, verifications = []; document.body.querySelector('#profileName').innerHTML = userData.name; document.title = `${userData.name} - Keyoxide`;