Skip to content

Event Handlers for Async requests resulting in exceptions don't call the OnResponse method #849

@jweber

Description

@jweber

Event Handlers for Async requests resulting in exceptions don't call the OnResponse method


Describe the bug

Calls that result in an Exception thrown by the client (e.g. NotFound) only call the OnResponse() method of registered event handlers if the call is not made using the Async overloads.

It appears that the HandleResponse method which can throw these exceptions is called before the EventHandlers are in the MakeRequestAsync method, but in the synchronous implementation, HandleResponse is called after the EventHandlers are run.

To Reproduce

Make the same call synchronously and asynchronously that results in a failure using a client with an event handler registered, and observe that the OnResponse method of the event handler is only fired for the synchronous call.

Expected behavior

The OnResponse method for event handlers should fire before an exception is thrown by the HandleResponse method.

Your Environment

  • Which version of this library are you using? 4.58.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions