public void flushMessages()
	throws CopperException
	{
		Queue<CompilerLogMessage> messages = handler.flushMessageQueue();
		CompilerLogMessage throwExceptionForMsg = null;
		long requiresFailure = -1;
		for(CompilerLogMessage msg : messages)
		{
			if(msg.isRequiresImmediateFailure())
			{
				throwExceptionForMsg = msg;
			}
		}
		for(CompilerLogMessage msg : messages)
		{
			printMessage(msg);
			if(msg.sort.isErrorLevel()) requiresFailure = msg.sequenceNumber;
		}
		if(throwExceptionForMsg != null)
		{
			throwException(throwExceptionForMsg);
		}
		else if(requiresFailure != -1)
		{
			throwException(new CompilerLogMessage(requiresFailure + 1,System.currentTimeMillis(),"Errors raised in compilation",CompilerLogMessageSort.ERROR,null,true));
		}
	}