Skip to content

Commit

Permalink
widget: fix error message content
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 authored and ntarocco committed Nov 30, 2023
1 parent 57e2bfa commit 3796fbf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/elements/ErrorMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ const FieldErrorList = ({ fieldErrors }) => {
return (
<Message.Item key={error}>
{/* when there is no field Marshmallow returns _schema */}
{error.field !== "_schema" && <strong>{error.field}: </strong>}
{error.messages.length === 1 ? (
{error.field && error.field !== "_schema" && (
<strong>{error.field}: </strong>
)}
{error.message ? (
error.message
) : error.messages && error.messages.length === 1 ? (
error.messages[0]
) : (
<Message.List>
Expand Down

0 comments on commit 3796fbf

Please sign in to comment.