goodmami / penman

PENMAN notation (e.g. AMR) in Python
https://penman.readthedocs.io/
MIT License
139 stars 27 forks source link

--check should have a non-zero return code on errors #63

Closed goodmami closed 4 years ago

goodmami commented 4 years ago

The default logging level does not print model errors found with --check or from recoverable parsing errors, so they will can go unnoticed. The program should thus exit with some non-zero code so other scripts can detect the problems. The return code should probably be 0 if --check is not used.

It might also be good to adjust the default logging level from ERROR to WARNING so problems are more obvious. It could be misleading if someone uses --check without -v and sees no warning messages.

goodmami commented 4 years ago

Generalizing this issue beyond just --check. It would also be nice to have other error codes for different kinds of errors. Here's some info: http://tldp.org/LDP/abs/html/exitcodes.html. Also see /usr/include/sysexits.h. Basically, don't use 1 or 2, 126--165, or 255 as they have special meanings.

How about (for now)

goodmami commented 4 years ago

undo

On second thought, printed error messages are more user friendly and I don't think it's necessary to make the penman command scriptable with custom error codes. The lexical/parsing errors already return 1 and print the exception (which is fairly informative). All that's needed here is to return 1 when a check finds errors.