From 33a9b4367a4945ddbfff6563c58c7a669d49966b Mon Sep 17 00:00:00 2001 From: Adrian Andersen Date: Mon, 17 Jun 2024 22:38:59 +0200 Subject: [PATCH 1/2] fix(ScannerModal): hide nasty API errors from user --- src/components/matches/Scanner/ScannerModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/matches/Scanner/ScannerModal.tsx b/src/components/matches/Scanner/ScannerModal.tsx index e0f2bf03..73b23b8c 100644 --- a/src/components/matches/Scanner/ScannerModal.tsx +++ b/src/components/matches/Scanner/ScannerModal.tsx @@ -93,7 +93,11 @@ const ScannerModal = ({ severity: feedback ? "info" : "success", visible: true, }); - handleItemTransferred?.(); + try { + handleItemTransferred?.(); + } catch { + // Do not expose potentially rough API errors to user + } } catch (error) { setFeedback({ text: String(error), From f0f61dd0321ca70a56a01c231f6199091592a902 Mon Sep 17 00:00:00 2001 From: Lars Mitsem Selbekk Date: Tue, 18 Jun 2024 17:20:54 +0200 Subject: [PATCH 2/2] refactor(scanner): nit --- src/components/matches/Scanner/ScannerModal.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/matches/Scanner/ScannerModal.tsx b/src/components/matches/Scanner/ScannerModal.tsx index 73b23b8c..cca96cb8 100644 --- a/src/components/matches/Scanner/ScannerModal.tsx +++ b/src/components/matches/Scanner/ScannerModal.tsx @@ -95,8 +95,9 @@ const ScannerModal = ({ }); try { handleItemTransferred?.(); - } catch { + } catch (error: unknown) { // Do not expose potentially rough API errors to user + console.error("Got error when handling item transferred", error); } } catch (error) { setFeedback({