Skip to content

Check cause chain of exceptions when handling redirects #13487

@jchadwick-buf

Description

@jchadwick-buf

Describe the problem

Right now, the Connect ES library wraps exceptions thrown inside of calls (including interceptors written by users) into ConnectError, with the original error thrown placed into the cause field. Because of this, when you do a redirect call inside of a connect-es interceptor, it doesn't work as expected.

Describe the proposed solution

Since the cause field is now widely supported, it would be very nice if code that checks for Redirect exceptions could also check the chain of causes.

Alternatives considered

  • An easy-but-cumbersome work-around is to wrap each call to a Connect ES client with a try/catch handler, detect a redirect in the cause and re-throw that. This works today, but it has to be done manually at each RPC call-site, so it is far from ideal.
  • Connect ES could be changed to not wrap errors thrown in interceptors, or make this behavior configurable. However, the sentiment for this change seems to be poor a few different reasons.

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions