From ad30e7425bab5f83db66d3132fecc9f436cc7607 Mon Sep 17 00:00:00 2001 From: Adrian Andersen Date: Tue, 18 Jun 2024 19:34:18 +0200 Subject: [PATCH] fix(ScannerModal): hide nasty API errors from user (#438) * fix(ScannerModal): hide nasty API errors from user * refactor(scanner): nit --------- Co-authored-by: Lars Mitsem Selbekk --- src/components/matches/Scanner/ScannerModal.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/matches/Scanner/ScannerModal.tsx b/src/components/matches/Scanner/ScannerModal.tsx index 862ef62..424c0e2 100644 --- a/src/components/matches/Scanner/ScannerModal.tsx +++ b/src/components/matches/Scanner/ScannerModal.tsx @@ -91,7 +91,12 @@ const ScannerModal = ({ severity: feedback ? "info" : "success", visible: true, }); - handleItemTransferred?.(); + try { + handleItemTransferred?.(); + } catch (error: unknown) { + // Do not expose potentially rough API errors to user + console.error("Got error when handling item transferred", error); + } } catch (error) { setFeedback({ text: String(error),