If a CompilerException occurs then first emit messages and then rethrow.