mirror of
https://github.com/StanGirard/quivr.git
synced 2024-08-17 17:10:22 +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 />;
|
||||
}
|
||||
|
||||
const { message, status, name } = JSON.parse(
|
||||
nonParsedMessage.replace(/'/g, '"')
|
||||
) as NotificationMessage;
|
||||
let message, status, name;
|
||||
|
||||
try {
|
||||
const parsedMessage = JSON.parse(
|
||||
nonParsedMessage.replace(/'/g, '"')
|
||||
) as NotificationMessage;
|
||||
|
||||
message = parsedMessage.message;
|
||||
status = parsedMessage.status;
|
||||
name = parsedMessage.name;
|
||||
} catch (error) {
|
||||
return <Fragment />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -42,9 +52,9 @@ export const NotificationDisplayer = ({
|
||||
</div>
|
||||
</div>
|
||||
{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"
|
||||
style={{ bottom: '-10px', right: '10px' }}
|
||||
style={{ bottom: "-10px", right: "10px" }}
|
||||
>
|
||||
{message}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user