dmcg
12/13/2023, 10:11 AMfun <T> AutoMappingConfiguration<T>.withStandardMappings() = apply {
text(duration())
text(uri())
text(url())
text(uuid())
text(regexObject())
text(instant())
text(yearMonth())
text(localTime())
text(localDate())
text(localDateTime())
text(zonedDateTime())
text(offsetTime())
text(offsetDateTime())
text(zoneId())
text(zoneOffset())
text(eventCategory())
text(traceId())
text(samplingDecision())
text(throwable())
text(locale())
int({ Status(it, "") }, Status::code)
}
which is really handy, but I’d like to change the handling for just Throwables. Can anyone thing of a good way to override the standards?
Context - I have some `Event`s that are also `Exception`s (try it, it’s really handy), but they are currently rendered with .toString()
not as structured objectsdave
12/13/2023, 10:35 AMaddLast
. Not sure if there is the equivalent in Jackson, but might be worth having a lookdmcg
12/13/2023, 2:34 PMfun throwable() = BiDiMapping({ throw Exception(it) }, Throwable::asString)
Deserializing a throwable throws an exception?dave
12/13/2023, 2:35 PMdmcg
12/13/2023, 2:35 PMAndrew O'Hara
12/13/2023, 3:03 PMdmcg
12/13/2023, 3:06 PMerror("Cannot deserialize a Throwable with message $it")
but I can see the current is less typingAndrew O'Hara
12/13/2023, 3:08 PMdmcg
12/13/2023, 3:20 PM