Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Exception #401

Open
itsdivyanshjain opened this issue Mar 11, 2021 · 5 comments
Open

Handle Exception #401

itsdivyanshjain opened this issue Mar 11, 2021 · 5 comments
Labels
code quality Code Quality-related issue/PR no functional changes

Comments

@itsdivyanshjain
Copy link
Collaborator

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

@itsdivyanshjain
Copy link
Collaborator Author

@securestep9 If you found this as a valid issue, then I would like to take up this issue.

@securestep9
Copy link
Collaborator

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

@securestep9 securestep9 added the code quality Code Quality-related issue/PR no functional changes label Mar 16, 2021
@itsdivyanshjain
Copy link
Collaborator Author

itsdivyanshjain commented Mar 16, 2021

Sure @securestep9 . I will do that

@Rohan-Salwan
Copy link

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.

@itsdivyanshjain
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Code Quality-related issue/PR no functional changes
Projects
None yet
Development

No branches or pull requests

3 participants