Handle Exception
We should use except exception as e instead of only except exception, otherwise it often difficult to debug the code. Like in issue #398 it shows module not exists because of import error in that module. This often deceiving and sometimes take bit of our time.
OS: Backbox
OS Version: 7.1
Python Version: 3.8.5
@securestep9 If you found this as a valid issue, then I would like to take up this issue.
Hi @itsdivyanshjain , yes, it is a valid point to improve code quality. Please do check and review PR #403 first - DeepSource tool was used to analyse the code to find few other code quality issues
Sure @securestep9 . I will do that
Hi @itsdivyanshjain Actually Nettacker tool has its own default set of messsages for any exception case so you want to replace this message with exception and traceback detailes. plz share your thoughts on this and guide me.
Hey @Rohan-Salwan,
Nettacker does have set of messages, but when it breaks it goes for an exception and print the particular line from a set of messages which may be deceptive. In case of issue #398 it's showing module port_scan is not available and while debugging we get to know about an issue which is importerror in port_scan module. So, here clearly we didn't handle exception clearly well. Remember using exception as e is not a solution as well, the important thing is to improve exception handling.
P.s: currently Nettacker going from lot of changes because of that you should wait for changes to merge then send PR if you want any improvement.