You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Catching all exceptions makes perfect sense in some scenarios. I.e. in this one because the builder module want to print a reasonable error message which the user can read (as argued before in other issues).
The committed patch will print the full stacktrace to provide more information in case of errors.
The patch makes things much better already, so I won't complain. But catching Exception in a non-UI function remains a bad idea, it invalidates the function as a library call for other tools. So If this was done in catkin_make or catkin_make_isolated (or some wrapper function without algorithmic value just for user interaction), I would not flag it as a style issue.
cwecht
pushed a commit
to cwecht/catkin
that referenced
this issue
Mar 20, 2018
In catkin/python/catkin/builder.py, line 608:
catching all of Exception is generally bad practice,
http://docs.python.org/2/howto/doanddont.html
http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Exceptions
and it leads to mysterious error messages like here:
http://answers.ros.org/question/56962/catkin-bfl-build-fails-nonetype-object-has-no-attribute-rfind/
Instead, only a subset of exceptions should be handled, such as
It would be even better if catkin defined an own Exception class that library code can raise when the user is supposed to only see the message.
Helping users fix errors themselves and report with stack traces helps us all maintain catkin and catkin packages with less effort.
The text was updated successfully, but these errors were encountered: