Skip to content

Commit

Permalink
ensure unique error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
chad1008 committed Sep 13, 2024
1 parent 8d8a477 commit 7e466e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/my-sites/email/form/mailboxes/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ abstract class BaseValidator< T > implements Validator< T > {
abstract validateField( field: MailboxFormFieldBase< T > ): Promise< void >;

protected addError( field: MailboxFormFieldBase< T >, error: SingleFieldError ): void {
if ( field.error?.includes( error ) ) {
return;
}

if ( field.error === null ) {
field.error = [ error ];
} else if ( Array.isArray( field.error ) ) {
Expand Down

0 comments on commit 7e466e1

Please sign in to comment.