Skip to content

Consider better handling of invalid values when using CRUD API #554

Description

@drn05r

If you try to create an eprint record via EPrints::Apache::CRUD and you specify a value for a field that is invalid (e.g. a text string for a MetaField::Int) then the eprint data object will not be created and then when the CRUD API tries to interrogate it so it can provide a response back to the client you end up getting a 500 internal server error with an error message like:

Can't call method "uri" on an undefined value at /opt/eprints3/perl_lib/EPrints/Apache/CRUD.pm line 1798.

It would be better that either we catch this inside the import plugin with some validation and return a appropriate error message or at least check in the CRUD API that the object exists (i.e. has been created) before trying to get its URI. If it is not created we should probably return a "400 Bad Request" response.

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions