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 }