Skip to content

Allow to decide if to retry based on error message #377

@kramarz

Description

@kramarz

Is your feature request related to a problem? Please describe.
Getting error like:

{"name":"Error","message":"13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: read ECONNRESET","stack":"at Object.callErrorFromStatus (/usr/local/autotrader/app/node_modules/@grpc/grpc-js/build/src/call.js:31:26)"}

I want to be able to retry such error, but not all INTERNAL errors.
Describe the solution you'd like
Allow to specify custom shouldRetryFn function that could return True if error message contains certain phrase.
this function would be part of RetryOptions that you can pass as override to createApiCall
Describe alternatives you've considered

  • It is currently possible to retry all errors with INTERNAL code.
  • Other solution would be adding separate error code for connection errors to grpc library, which could break existing solutions for others relying on INTERNAL code.
  • In streaming calls it is already possible to specify similar shouldRetryFn function. Normal calls should also have such option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: 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