3 ms·
struct Error { XAtLine47, XAtLine88, YAtLine13, } This way you have error AND error place as contextualization.
by swfsql 7y ago
struct Error {
XAtLine47,
XAtLine88,
YAtLine13,
}
This way you have error AND error place as contextualization.
- NieDzejkob 7y agoTo be honest, I can't tell if you're being serious.
- shepmaster 7y agoLike the sibling, I'm not sure if you are serious, but my library SNAFU (https://docs.rs/snafu/0.6.0/snafu/ https://docs.rs/snafu/0.6.0/snafu/) is similar to this at a step or two higher level. The idea is that you wrap lower-level errors (a file system error) with a higher-level context (opening the config file). Taken to the extreme, you have a unique context for every possible error source inside your library, which means you could directly search for the name to find the line number. This does make me wonder how I could add line / file information to an error automatically though.