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

url: remove traceback from debug log when fetching URL fails #2280

Merged
merged 1 commit into from
May 19, 2022

Conversation

half-duplex
Copy link
Member

Description

If url.py can't connect to a server because of things like certificate issues (https://expired.badssl.com/), DNS (http://fake.host.local/), etc, it currently dumps most of a page of exception tracebacks into logs. This is useful to nobody, and it shouldn't do that.

This patch replaces the page of tracebacks with the following:
sopel.modules.url DEBUG - Unable to reach URL: 'http://fake.host/': HTTPConnectionPool(host='fake.host', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f95ef238340>: Failed to establish a new connection: [Errno -2] Name or service not known'))
I think that's quite sufficient for troubleshooting without being excessively spammy.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

@half-duplex half-duplex added this to the 8.0.0 milestone May 16, 2022
@Exirel Exirel changed the title url: don't vomit unsurprising exceptions into log url: remove traceback from debug log when fetching URL fails May 16, 2022
@Exirel
Copy link
Contributor

Exirel commented May 16, 2022

  1. language
  2. a title that makes sense

Thank you.

@dgw dgw added the Tweak label May 19, 2022
@dgw
Copy link
Member

dgw commented May 19, 2022

@Exirel Changing the title doesn't modify the message of the commit that gets merged, though. (It makes sense to me, though, so I don't mind keeping it.)

@dgw dgw merged commit c560c6d into sopel-irc:master May 19, 2022
@half-duplex half-duplex deleted the url-bad-cert branch May 19, 2022 22:16
@Exirel
Copy link
Contributor

Exirel commented May 19, 2022

I'm still annoyed by "vomit unsurprising exception", because 1. it's not "vomiting" anything, it outputs a debug traceback, and 2. it's not unsurprising at all.

@dgw
Copy link
Member

dgw commented May 19, 2022

Then next time you can request the commit message be modified to match your new PR title. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants