Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error message in PostCard.tsx #3152

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/UserPortal/PostCard/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,16 @@
setComments([...comments, newComment]);
}
} catch (error: unknown) {
errorHandler(t, error);
if (error instanceof Error) {
error.message
.replace(/^Comment validation failed:\s*/, '')
.replace(/Path `text` is required\./, '')
palisadoes marked this conversation as resolved.
Show resolved Hide resolved
.trim();
toast.error('Please enter a comment before submitting.');
} else {
toast.error('An unexpected error occurred. Please try again.');
errorHandler(t, error);

Check warning on line 236 in src/components/UserPortal/PostCard/PostCard.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/UserPortal/PostCard/PostCard.tsx#L235-L236

Added lines #L235 - L236 were not covered by tests
}
}
};

Expand Down
Loading