diff --git a/src/components/safe-messages/DecodedMsg/index.tsx b/src/components/safe-messages/DecodedMsg/index.tsx index 88c79f8ebb..dbb4303ac5 100644 --- a/src/components/safe-messages/DecodedMsg/index.tsx +++ b/src/components/safe-messages/DecodedMsg/index.tsx @@ -10,6 +10,7 @@ import { isAddress } from 'ethers' import type { ReactElement } from 'react' import Msg from '../Msg' import css from './styles.module.css' +import { logError, Errors } from '@/services/exceptions' const EIP712_DOMAIN_TYPE = 'EIP712Domain' @@ -75,7 +76,13 @@ export const DecodedMsg = ({ } // Normalize message such that we know the primaryType - const normalizedMsg = normalizeTypedData(message) + let normalizedMsg: EIP712Normalized + try { + normalizedMsg = normalizeTypedData(message) + } catch (error) { + logError(Errors._809, error) + normalizedMsg = message as EIP712Normalized + } return ( { const wallet = useWallet() const isConfirmed = msg.status === SafeMessageStatus.CONFIRMED const safeMessage = useMemo(() => { - return generateSafeMessageMessage(msg.message) + try { + return generateSafeMessageMessage(msg.message) + } catch (e) { + return '' + } }, [msg.message]) const verifyingContract = isEIP712TypedData(msg.message) ? msg.message.domain.verifyingContract : undefined @@ -65,7 +70,9 @@ const MsgDetails = ({ msg }: { msg: SafeMessage }): ReactElement => { } > - + Error decoding message}> + + @@ -73,7 +80,7 @@ const MsgDetails = ({ msg }: { msg: SafeMessage }): ReactElement => { {formatDateTime(msg.creationTimestamp)} {formatDateTime(msg.modifiedTimestamp)} {generateDataRowValue(msg.messageHash, 'hash')} - {generateDataRowValue(safeMessage, 'hash')} + {safeMessage && {generateDataRowValue(safeMessage, 'hash')}} {msg.preparedSignature && ( diff --git a/src/components/safe-messages/MsgListItem/ExpandableMsgItem.tsx b/src/components/safe-messages/MsgListItem/ExpandableMsgItem.tsx index 22e5637f07..8e73fa8909 100644 --- a/src/components/safe-messages/MsgListItem/ExpandableMsgItem.tsx +++ b/src/components/safe-messages/MsgListItem/ExpandableMsgItem.tsx @@ -1,7 +1,8 @@ -import { Accordion, AccordionDetails, AccordionSummary } from '@mui/material' +import { Accordion, AccordionDetails, AccordionSummary, Box } from '@mui/material' import ExpandMoreIcon from '@mui/icons-material/ExpandMore' import type { ReactElement } from 'react' import type { SafeMessage } from '@safe-global/safe-gateway-typescript-sdk' +import { ErrorBoundary } from '@sentry/react' import MsgDetails from '@/components/safe-messages/MsgDetails' import MsgSummary from '@/components/safe-messages/MsgSummary' @@ -26,7 +27,9 @@ const ExpandableMsgItem = ({ msg, expanded = false }: { msg: SafeMessage; expand - + Failed to render message details}> + + )