Skip to content

Commit

Permalink
Add validation to prevent runtime error
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Sep 13, 2024
1 parent db09c38 commit 0f50079
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hooks/useToastError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export function showErrorToast<ErrorType>(
if (responseMessage) message = responseMessage
}

message = truncate(message, { length: 150 })
message = truncate(typeof message === 'string' ? message : '', {
length: 150,
})

toast.custom(
(t) => (
Expand Down

0 comments on commit 0f50079

Please sign in to comment.