LP 1502152: Improve marc_export warnings.
authorJason Stephenson <jstephenson@mvlc.org>
Mon, 5 Oct 2015 16:35:37 +0000 (12:35 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 4 Nov 2015 21:51:35 +0000 (21:51 +0000)
commitcf4410e4e6678e374ef716f708d6b6ac3567d0ab
tree33c4d2bbc78f7bef244eefd3c1ab0fddcd5c918a
parentab512d7bf135ebdf7888217bf5b04377398f00ec
LP 1502152: Improve marc_export warnings.

Trap warnings from MARC libraries in marc_export so we can report the
id of the record that triggered the warning.

Use warn to print our warnings, instead of print STDERR.  This includes
the existing errors, trapped by eval, that were being printed to STDERR.

To test
-------
[1] Ensure that a record has an error that would become apparent
    during export.  An easy way to do this is to insert the "‡"
    character in the contents of a subfield, then use
    --encoding MARC8 when exporting the record.
[2] Run the MARC export, e.g.,

    cat id_list | marc_export -i > /tmp/bibs.mrc
[3] Verify that a warning is reported, e.g.,

Warning from bibliographic record 1: no mapping found at position 0...

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/support-scripts/marc_export.in