mirror of
https://github.com/StanGirard/quivr.git
synced 2024-09-11 21:17:36 +03:00
fix: wrap parsing with try catch (#1321)
This commit is contained in:
parent
a8f9edb21f
commit
bf5b7553d5
@ -20,9 +20,19 @@ export const NotificationDisplayer = ({
|
|||||||
return <Fragment />;
|
return <Fragment />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { message, status, name } = JSON.parse(
|
let message, status, name;
|
||||||
nonParsedMessage.replace(/'/g, '"')
|
|
||||||
) as NotificationMessage;
|
try {
|
||||||
|
const parsedMessage = JSON.parse(
|
||||||
|
nonParsedMessage.replace(/'/g, '"')
|
||||||
|
) as NotificationMessage;
|
||||||
|
|
||||||
|
message = parsedMessage.message;
|
||||||
|
status = parsedMessage.status;
|
||||||
|
name = parsedMessage.name;
|
||||||
|
} catch (error) {
|
||||||
|
return <Fragment />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -42,9 +52,9 @@ export const NotificationDisplayer = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{isHovered && (
|
{isHovered && (
|
||||||
<div
|
<div
|
||||||
className="absolute bg-white p-2 rounded-sm border border-gray-100 shadow-sm transition-transform transform translate-y-1 translate-x-1/4 z-10"
|
className="absolute bg-white p-2 rounded-sm border border-gray-100 shadow-sm transition-transform transform translate-y-1 translate-x-1/4 z-10"
|
||||||
style={{ bottom: '-10px', right: '10px' }}
|
style={{ bottom: "-10px", right: "10px" }}
|
||||||
>
|
>
|
||||||
{message}
|
{message}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user