3 ms·
This reminds me of a trick Monotone VCS in C++ had to print out specific variables upon failure. Usually they'd do nothing, but upon hitting an invariant or sim
by mkj 6y ago
This reminds me of a trick Monotone VCS in C++ had to print out specific variables upon failure. Usually they'd do nothing, but upon hitting an invariant or similar it would dump all the listed ones out. A bit harder to do cheaply in a safe language like Rust I guess...
MM(variabletodump);
example https://github.com/graydon/monotone/blob/master/graph.cc#L495 https://github.com/graydon/monotone/blob/master/graph.cc#L49...
docs https://github.com/graydon/monotone/blob/master/HACKING#L252 https://github.com/graydon/monotone/blob/master/HACKING#L252
The implementation was a bit hairy https://github.com/graydon/monotone/blob/master/sanity.hh#L469 https://github.com/graydon/monotone/blob/master/sanity.hh#L4...
- Nullabillity 6y agoThe usual Rust answer would be to build a structured wrapper error (which you'd usually have to do anyway, once you have more than one error source). Then you can just add whatever debug data you want to it.