public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 widget-toolkit] improve error handling when adding webauthn entries
@ 2021-11-30 10:04 Wolfgang Bumiller
  2021-12-02 18:19 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfgang Bumiller @ 2021-11-30 10:04 UTC (permalink / raw)
  To: pve-devel

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 <w.bumiller@proxmox.com>
---
changes to v1:
  * move console.error() call up
  * check for type `object` explicitly
  * use `?.` operator to get the message

 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.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH v2 widget-toolkit] improve error handling when adding webauthn entries
  2021-11-30 10:04 [pve-devel] [PATCH v2 widget-toolkit] improve error handling when adding webauthn entries Wolfgang Bumiller
@ 2021-12-02 18:19 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-12-02 18:19 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

On 30.11.21 11:04, Wolfgang Bumiller wrote:
> 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 <w.bumiller@proxmox.com>
> ---
> changes to v1:
>   * move console.error() call up
>   * check for type `object` explicitly
>   * use `?.` operator to get the message
> 
>  src/window/AddWebauthn.js | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-02 18:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 10:04 [pve-devel] [PATCH v2 widget-toolkit] improve error handling when adding webauthn entries Wolfgang Bumiller
2021-12-02 18:19 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal