Make validation errors less verbose #1921
Labels
topic: validation
Infrastructure for checking various properties of objects, making sure they are valid.
type: feature
New features and improvements to existing features
Validation errors tend to be very verbose. The information they provide is often required to figure out what went wrong in the first place, so we can't outright remove that information from the error message. But it would be nice, if they were less verbose by default, and there was a flag in the standard model CLI to switch on full verbosity. I've looked into this and, unfortunately, didn't find a good solution.
Formatting can be controlled from the outside by enabling an "alternate" mode (
{:#}
instead of{}
) and it's straight-forward to change formatting based on that. However, we don't fully control validation error formatting. It's possible that the validation errors end up being returned from amain
function (which happens with the default setup), and then formatting is controlled by Rust's error handling machinery, Anyhow,, and/orthiserror
, and I don't know how to enable the alternate mode then.Another idea I have, is to add a flag to the validation error types themselves, which would allow us to control verbosity when they're created. This sounds practical, but requires changes to all error types, plus some generic infrastructure to prevent duplication.
The text was updated successfully, but these errors were encountered: