json icon indicating copy to clipboard operation
json copied to clipboard

How to get message back out of `Error`

Open Alfred-Mountfield opened this issue 2 years ago • 0 comments

I'm wondering how you're supposed to do error handling using serde_json?

Custom error messages get turned into plain strings inside the Error::Message() struct which makes them unmatchable. There also doesn't seem a way to get access to Error::Message at all so it would seem someone would have to rely on the output of fmt::Display, which sometimes modifies the string as "{} at line {} column {}" so you'd have to split the string on some plain text.

Alfred-Mountfield avatar Aug 26 '22 10:08 Alfred-Mountfield