From 834cc8476dfe6a0b41edd7661e520f1a5ec046ae Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 30 Nov 2021 11:04:03 +0100 Subject: [PATCH] improve error handling when adding webauthn entries There are cases where we directly throw a string error (particularly, when navigator.credentials.create() fails, for example when trying to register the same WA device to the same user twice), which would end up with the WA window simply not closing before. Signed-off-by: Wolfgang Bumiller --- src/window/AddWebauthn.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/window/AddWebauthn.js b/src/window/AddWebauthn.js index f4a0b10..bef13d1 100644 --- a/src/window/AddWebauthn.js +++ b/src/window/AddWebauthn.js @@ -141,8 +141,13 @@ Ext.define('Proxmox.window.AddWebauthn', { params, }); } catch (response) { - let error = response.result.message; + let error = response; console.error(error); // for debugging if it's not displayable... + if (typeof error === "object") { + // in case it came from an api request: + error = error.result?.message; + } + Ext.Msg.alert(gettext('Error'), error); } -- 2.39.2