haros icon indicating copy to clipboard operation
haros copied to clipboard

Provide better error messages

Open git-afsantos opened this issue 6 years ago • 2 comments

For most errors, the user is presented a stack trace of the corresponding exception. As suggested in #41, better error messages should be provided.

To accomplish this, a central error reporting utility might be a good idea, so as to avoid spreading print all over the place. The util.py script is a good candidate for this.

It might also be worth it to change the current logging behaviour. Use two loggers, instead of one. One, by default, prints everything from INFO and above to the log file, unless --debug is set, in which case DEBUG is also logged. The second logger is used with a better formatting to print messages to the user.

Another interesting idea, while messing with error handling, is to define custom exit codes, so that failures are better identified. See this SO answer or this page for ideas of standard and unallocated error codes.

git-afsantos avatar Mar 09 '19 17:03 git-afsantos

This line may return None if the provided project file does not contain any YAML documents.

This leads to this line raising

AttributeError: 'NoneType' object has no attribute 'get'

git-afsantos avatar Apr 17 '19 13:04 git-afsantos

https://github.com/git-afsantos/haros/issues/72#issuecomment-519729404

The documentation did not mention that the plugin name must be preceded by "haros_plugin_", and the error message made it sound like no plugins (at all) were found instead of just this particular plugin not being found.

Try to distinguish between not finding any plugins and simply not finding any for the user-provided names.

git-afsantos avatar Aug 09 '19 07:08 git-afsantos