Problem/Motivation

Errors triggered when creating references, namely those caused when entering author names, create very visible error messages, without giving a good indication as to what caused the error.

Steps to reproduce

Create a reference, and in the Authors field enter something like “Mr. Smith”. When you save the reference, you will get a full-page error message due to an ADCI FullNameParser Exception, with a handy-for-developers stack trace. What you don't get is a simple error message on the form indicating “you need to include a first name” or similar.

This also occurs if you enter too many commas in the Author field, either due to a complicated author name, or if the user is trying to enter multiple authors in a single field, separated by commas.

Proposed resolution

The bibcite module should gracefully process the exception, and provide clearer details to the user.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork bibcite-3567338

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

byronveale created an issue. See original summary.

bkosborne’s picture

I'm a bit puzzled on the best place to catch this exception and bubble it up as a form error. This seems complicated because the exception occurs when the entity autocomplete field tries to auto-create a contributor entity that doesn't exist yet, and the input is invalid.

I think the simplest method may be to add an #element_validate to the contributor field in a form_alter and manually validate the label of the contributor by passing it thru the name parser and check for an exception. Kind of clunky but not sure there's a better way?

bkosborne’s picture

Status: Active » Needs work
byronveale’s picture

Status: Needs work » Needs review

See new descriptive error message, I think this should be good to go…

bkosborne’s picture

Status: Needs review » Reviewed & tested by the community

looks good to me

mark_fullmer’s picture

Status: Reviewed & tested by the community » Fixed

Yes, this looks great. Manual testing also checks out. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.