Improved exceptions and reporting exceptions for command-line compiler.

You should decide to always do it like that, or use your createTypeError function.