refit icon indicating copy to clipboard operation
refit copied to clipboard

[Bug]: How do we capture exceptions, which are not propagated through `RefitSettings.ExceptionFactory`?

Open uhfath opened this issue 1 year ago • 0 comments

Describe the bug 🐞

If exceptions occur during deserializing, they are not passed through RefitSettings.ExceptionFactory. For example, these: https://github.com/reactiveui/refit/blob/4744780644ecaa5e23ee93fccbadd9528eaa6add/Refit/RequestBuilderImplementation.cs#L280 https://github.com/reactiveui/refit/blob/4744780644ecaa5e23ee93fccbadd9528eaa6add/Refit/RequestBuilderImplementation.cs#L298

Step to reproduce

  1. Replace ExceptionFactory in RefitSettings with a custom factory;
  2. Send a request that returns malformed JSON document;
  3. The exception will not be passed to your custom factory.

Reproduction repository

https://github.com/reactiveui/refit

Expected behavior

All exceptions should be passed through RefitSettings.ExceptionFactory. Currently we are forced to try/catch every refit call, since these exceptions occur outside of message handlers.

Screenshots 🖼️

No response

IDE

Visual Studio 2022

Operating system

Windows

Version

No response

Device

No response

Refit Version

7.0.0

Additional information ℹ️

No response

uhfath avatar Aug 01 '23 12:08 uhfath