From 488e6955906d97ceacfd3241af478c9b53e76190 Mon Sep 17 00:00:00 2001 From: fAnselmi-Ledger Date: Wed, 23 Oct 2024 10:43:27 +0200 Subject: [PATCH] fix(llm): parsed bluetooth error on CLS --- .changeset/hip-horses-rescue.md | 5 +++++ .../components/CustomLockScreenDeviceAction/index.tsx | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/hip-horses-rescue.md diff --git a/.changeset/hip-horses-rescue.md b/.changeset/hip-horses-rescue.md new file mode 100644 index 000000000000..9c0ace58a82a --- /dev/null +++ b/.changeset/hip-horses-rescue.md @@ -0,0 +1,5 @@ +--- +"live-mobile": patch +--- + +Parsed bluetooth error on mobile CLS diff --git a/apps/ledger-live-mobile/src/components/CustomLockScreenDeviceAction/index.tsx b/apps/ledger-live-mobile/src/components/CustomLockScreenDeviceAction/index.tsx index 8015f820d8f1..8744eb93a5a9 100644 --- a/apps/ledger-live-mobile/src/components/CustomLockScreenDeviceAction/index.tsx +++ b/apps/ledger-live-mobile/src/components/CustomLockScreenDeviceAction/index.tsx @@ -22,6 +22,7 @@ import { RenderImageLoadRequested, RenderLoadingImage, } from "./stepsRendering"; +import { BluetoothRequired } from "@ledgerhq/errors"; type Props = { device: Device; @@ -89,11 +90,18 @@ const CustomImageDeviceAction: React.FC void }> = ({ ); const { error, imageCommitRequested, imageLoadRequested, loadingImage, progress } = status; + const isError = !!error; const isRefusedOnStaxError = (error as unknown) instanceof ImageLoadRefusedOnDevice || (error as unknown) instanceof ImageCommitRefusedOnDevice; + const parseErrror = (error: Error) => + ({ + BleError: new BluetoothRequired(), + BluetoothRequired: new BluetoothRequired(), + })[error?.name] || error; + useEffect(() => { // Once transferred the old image is wiped, we need to clear it from the data. if (error instanceof ImageCommitRefusedOnDevice) { @@ -120,7 +128,7 @@ const CustomImageDeviceAction: React.FC void }> = ({ {renderError({ t, - error, + error: parseErrror(error), device, ...(isRefusedOnStaxError ? { Icon: Icons.Warning, iconColor: "warning.c60", hasExportLogButton: false }