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
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 theOnResponse()
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 theEventHandlers
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 theHandleResponse
method.Your Environment
4.58.0