Improvements to exception serialization? #2098
darren-clark
started this conversation in
Ideas
Replies: 1 comment
-
Thanks @darren-clark for this idea! I went ahead and converted it into an issue and put it on the backlog. #2103 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm getting into a place where I'm throwing exception that the default serializer won't handle.
In my case it's pretty easy thing to handle with a
JsonConverter
.However that means I need to replace the
JsonSerializerOptions
by injecting anIErrorSerializerSettingsFactory
All I really want to do is just add a JsonConverter to the serializer. The default(and internal) serializer uses a custom(also internal) contract resolver, which looks like it's probably useful.
At this point I'm trying to do one of two things:
IErrorSerializerSettingsFactory
with one that wraps the current one. Which is unpleasant because I then need to have some sort of decorator implementation or inject IServiceProvider into my implementation, callGetServices
and then find the "not me" one. Made more ugly that the default implementation also caches the settings, which is good, but also means that I don't always want to add my converter.My suggestion would be to support registration of a new interface
IErrorSerializerSettingsConfiguration
or something that the default factory would enumerate implementations of and pass the settings through them sequentially before caching it.Beta Was this translation helpful? Give feedback.
All reactions