-
Notifications
You must be signed in to change notification settings - Fork 104
Minor exception-related updates #75
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
Conversation
@@ -65,10 +68,14 @@ def __init__( | |||
message: str, | |||
*details: Any, | |||
type: Optional[str] = None, | |||
non_retryable: bool = False | |||
non_retryable: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we control the default value can we change this to retryable: bool = True
to improve readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like the init param names to match the property names. Currently we expose Java isNonRetryable, Go NonRetryable, TS nonRetryable, etc.
super().__init__( | ||
message, | ||
# If there is a type, prepend it to the message on the string repr | ||
exc_args=(message if not type else f"{type}: {message}",), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not override __str__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to alter the Exception.args
not just the string. That way our exception, like basically all other Python exceptions, still has str(exception) == str(exception.args)
. Doesn't seem to have benefit only alter the string representation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM
What was changed
ApplicationError
to prepend the type to the message if present when showing the string formatERROR
toWARN
DEBUG
toWARN
Checklist