Skip to content

fix: replace bare except Exception with specific ftplib exceptions#902

Open
mitre88 wants to merge 1 commit into
threat9:masterfrom
mitre88:fix/broad-except-clauses
Open

fix: replace bare except Exception with specific ftplib exceptions#902
mitre88 wants to merge 1 commit into
threat9:masterfrom
mitre88:fix/broad-except-clauses

Conversation

@mitre88
Copy link
Copy Markdown

@mitre88 mitre88 commented May 1, 2026

Summary

Replaced bare except Exception clauses with specific ftplib.all_errors exceptions in the FTP client.

Why

Using broad except Exception clauses can mask errors and make debugging difficult. The ftplib.all_errors tuple is the appropriate exception type for FTP operations.

Changes

  • connect(): Changed to except ftplib.all_errors, OSError
  • login(): Changed to except ftplib.all_errors, added error logging
  • get_content(): Changed to except ftplib.all_errors, OSError
  • close(): Changed to except ftplib.all_errors, OSError

Affects: routersploit/core/ftp/ftp_client.py

… FTP client

Using broad except Exception clauses can mask errors and make debugging
difficult. Replaced with ftplib.all_errors which is the appropriate
exception type for FTP operations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant