Skip to content

Commit

Permalink
fix(llm): parsed bluetooth error on CLS
Browse files Browse the repository at this point in the history
  • Loading branch information
fAnselmi-Ledger committed Oct 23, 2024
1 parent cbe7a69 commit 488e695
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hip-horses-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Parsed bluetooth error on mobile CLS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
RenderImageLoadRequested,
RenderLoadingImage,
} from "./stepsRendering";
import { BluetoothRequired } from "@ledgerhq/errors";

type Props = {
device: Device;
Expand Down Expand Up @@ -89,11 +90,18 @@ const CustomImageDeviceAction: React.FC<Props & { remountMe: () => 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) {
Expand All @@ -120,7 +128,7 @@ const CustomImageDeviceAction: React.FC<Props & { remountMe: () => void }> = ({
<Flex flex={1}>
{renderError({
t,
error,
error: parseErrror(error),
device,
...(isRefusedOnStaxError
? { Icon: Icons.Warning, iconColor: "warning.c60", hasExportLogButton: false }
Expand Down

0 comments on commit 488e695

Please sign in to comment.