Okay, lets brainstorm a bit about error handling! The two places where I expect errors to happen are configuration processing, and matcher instantiation.
In the former case, I want to report errors that point to the right place in the configuration. In the matcher instantiation case... a matcher may or may not be related to any configuration item, so I need to think about both cases.
For simplicity's sake, lets consider the case when no configuration is in play. Something like:
record Config {
whatever: matchers.Patterns,
}
fn compile_configuration() -> Result[Config, Report] {
let whatever = matchers.Patterns.new(["foo", "bar"])?;
Ok(Config { whatever: whatever })
}
If Patterns.new() fails, what should the error report look like?
(Also, ignore that the code mentions configuration - there's no user config processing going on, it's just the framework I'll eventually arrive to.)