Skip to content

Core: Retry.__init__ add on_error arg #7951

Closed

Description

@xmedeko

Retry.__call__ has on_error argument. I would like to have it in the Retry.__init__, too. I use it for own logging of retry.

Activity

  1. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    triage meI really want to be triaged.
    on May 13, 2019
  2. emar-kar commented on Jul 25, 2019

    @emar-kar
    Contributor

    @xmedeko Could you explain some details, please. As I understand you would like to add on_error argument into the Retry.__init__ method, but I really can not get how are you going to use it? Do you want it to be the class attribute, or you want it to be called in __init__?

  3. tseaver commented on Jul 25, 2019

    @tseaver
    Contributor

    @emar-kar I read the request that the on_error passed to the constructor would be saved as an attribute on the Retry instance, and used in every invocation as a fall-back if no on_error is passed. E.g.:

    from google.api_core.retry import Retry
    
    def error_callback(exception):
        psas
    
    retry = Retry(on_error=error_callback)
    
    # callback invoked for retryable exceptions
    retry(some_object.delete)()
  4. changed the title [-]Core: Retry.__init__ add on_error[/-] [+]Core: Retry.__init__ add on_error arg[/+] on Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: coretype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions