Skip to content

Format two exception messages that used %s with separate args - #8509

Merged
lups2000 merged 2 commits into
mitmproxy:mainfrom
Pharex38:fix/exception-messages
Oct 23, 2026
Merged

lups2000 merged 2 commits into
mitmproxy:mainfrom
Pharex38:fix/exception-messages

Conversation

@Pharex38

Copy link
Copy Markdown
Contributor

Description

BiDi.__getattr__ and OptManager.make_parser raised exceptions with logging-style arguments:

raise AttributeError("No such attribute: %s", k)
raise ValueError("Unsupported option type: %s", o.typespec)

Exceptions don't apply %-formatting, so the message came out as a tuple, e.g. AttributeError('No such attribute: %s', 'c'). Both now use f-strings.

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.

Pharex38 and others added 2 commits October 22, 2026 23:32
AttributeError/ValueError don't apply %-formatting, so these messages
came out as a tuple, e.g. ('No such attribute: %s', 'c').

@lups2000 lups2000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@lups2000
lups2000 merged commit 7cb3882 into mitmproxy:main Oct 23, 2026
28 checks passed
lups2000 pushed a commit to lups2000/mitmproxy that referenced this pull request Oct 31, 2026
…oxy#8509)

* Format two exception messages that used %s with separate args

AttributeError/ValueError don't apply %-formatting, so these messages
came out as a tuple, e.g. ('No such attribute: %s', 'c').

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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.

2 participants