Improved exceptions and reporting exceptions for command-line compiler.

This can be combined into a single line (along with others, consistent with codebase; single-line implementations in headers).