Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.73k stars 445 forks source link

Refactor proxy settings and add error handling #8033

Closed drew2a closed 1 month ago

drew2a commented 1 month ago

Reworked the 'set_proxy_settings' function in the download manager to handle invalid port values more gracefully. The function now attempts to convert the port value to an integer and logs any ValueError exceptions that occur during this process. This prevents crashes when non-integer values are provided for the port. Also, reorganized import statements according to PEP8 guidelines.

Additionally, a new test case 'test_set_proxy_settings_invalid_port' has been added to verify this behavior. It checks if proxy settings are not set when an invalid port number is provided.

Fixes #8014