-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
Allow retry_if_exception_message to specify regex flags #436
Comments
Not great but calling |
Oh, I didn't realize that would work. I'll close this then. |
I guess we should update the parameter type to capture this non-obvious flexibility? - match: typing.Optional[str] = None,
+ match: typing.Optional[str | re.Pattern] = None, in Lines 198 to 205 in 17aefd9
|
robertschweizer
added a commit
to robertschweizer/tenacity
that referenced
this issue
Sep 24, 2024
Suggested in jd#436 (comment)
This was referenced Sep 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, the implementation of
retry_if_exception_message
accepts a regular expression pattern in thematch
argument. This gets passed tore.compile
and used to perform a match against the exception message.However, since the argument is a regular expression pattern and not a
re.Pattern
object, users are unable to specify any of the regular expression flags. For example, one cannot passre.IGNORECASE
to specify case-insensitive matching.A proposed solution is to allow someone to pass an already compiled regular expression, a
re.Pattern
object, into thematch
argument so the caller has full control of the regular expression used, including flags.Relates to:
The text was updated successfully, but these errors were encountered: