This has a few advantages
- Less C++ code (about 300 lines less).
- Less machine code (about 14 KB of text on a linux x86_64 build).
- More debugger friendly. Just set a breakpoint on the exit function and you get the complete lld stack trace of when the error was found.
- It is a more robust API. The errors are handled early and we don't get a std::error_code hot potato being passed around.
- In most cases the error function in a better position to print diagnostics (it has more context).
error() does not particularly belong to Driver, so piggy-backing it with Driver doesn't seem a good idea to me. I'd move it to Error.h.