[Koha-bugs] [Bug 24574] Broken MARC records cause "invalid data, cannot decode object" on ISBDdetail and MARCdetail pages.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jul 13 12:58:41 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24574

--- Comment #4 from Rudolf Byker <rudolfbyker at gmail.com> ---
Owen, did you read Bug #23425 ? This is the same as that, but for different
pages.

It boils down to this: When "MARC::Record::new_from_xml" fails (this happens
e.g. when the XML file contains an incorrectly encoded character, or when a
record containing such a character is imported from a Z39.50 server), it should
be handled gracefully instead of crashing Koha, thereby allowing the user to
fix the invalid data.

So to reproduce:
- Get a MarcXML file with at least one incorrectly encoded character.
- Do something that causes that file to be sent to MARC::Record::new_from_xml

In CS, this is known simply as "Robustness". This is also why many programming
languages have the pattern of "checked exceptions", which forces you to either
handle an error/exception or re-throw it to be handled elsewhere. I'm not a
Perl programmer, so I'm not sure what the Perl equivalent of that would be.

An alternative to error handling is to prevent the error from happening at all.
Some text parsers allow you to replace incorrectly encoded characters by a
predefined string, like "?", thereby silencing any encoding errors in the
input. Whether this is acceptable, is a decision that depends on the use case.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list