Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 3.64 KB

error_and_warning_messages.md

File metadata and controls

30 lines (25 loc) · 3.64 KB

5.9. Error and warning messages

The Argparser outputs about a hundred different error and warning messages to give both you and your script's user as detailled feedback as possible about what went wrong with the argument parsing, value checking, etc. Each message starts with your script's canonical name (the ARGPARSER_SCRIPT_NAME), followed by either "Error:" or "Warning:" and the respective message. Using the same simplified YAML file as for the help and usage messages (the ARGPARSER_TRANSLATION_FILE), also the error and warning messages can be fully localized.

Generally, errors may lead to abortion of the script, while warnings just write the message to STDERR. Thus, warnings are less problematic errors, usually since some default or fallback value can be used, instead. The warning message then informs about this decision. Only for deprecated arguments, no default is used, simply because the Argparser does not use the information about deprecation other than for creating a message to your script's user. After all, a deprecated argument should still be fully functional, until the deprecation time has passed and you decide to fully remove the argument (or replace it by a dummy implementation—then without deprecation note—whose application raises an error within your script).

Using ARGPARSER_SILENCE_ERRORS and ARGPARSER_SILENCE_WARNINGS, it is possible to prevent the emission of error or warning messages. Still, in case of critical errors, the Argparser exits, just not informing you or your user about its failure. Silencing errors may not be needed at all, except when you want to keep log files clean, but silencing warnings may improve the user experience in some cases.

🡄 5.8. Version messages           5.10. Message styles 🡆