by lzutao · 7y ago · 0 comments
It would be cool if you just had a compiler flag that invokes an user settable handler function every time Err() gets constructed or something like that.
To give concrete examples, I was developing a library to generate certificates [1]. Often you generate a wrong one though and the parser library you use for testing gives you a Err(BadDer). If that's everything you are getting it can be a bit tough to find out the origins. As it was using ? I had to grep for all the places returning a BadDer error and replace them with a panic. Shadowing try! would have been much easier.