Is it possible to make it so refit exceptions aren't exposed to callers? #1470
Unanswered
ChristopherHaws
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am using Refit in a shared library and was wondering if it is possible to wrap
ApiException
andValidationApiException
so that users of the library don't need to know that Refit is being used under the hoods. As far as I can see, the only way to handle exceptions right now is viaExceptionFactory
, but even with this being implemented, Refit exceptions can still get thrown. Is the only way really to wrap the refit interface in another class and handle each exception manually?I did find this PR which seems to be about adding the ability to customize this functionality, but it is pretty old now:
#927
BTW, I would be ok if the solution required my custom exception to inherit
ApiException
orValidationApiException
, I am just hoping to make it so that our services that use the rest client nuget package (which uses refit under the hoods) doesn't expose refit specific exceptions in case we need to change to another library for some reason in the future. For example, if we switch away from using restful services for server-to-server communication and move to an event bus or gRPC, it would be nice if our client library could be updated without the services using it needing to change their code.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions