Realtimebattle-Team-Framework Manual
Author: David Tibbe and Tino Truppel

# Chapter 1.3 - Exceptions / Error handling (by Johannes Nicolai)

If you encounter an error, that you cannot handle properly in your component, the only way to report it is to throw an exception. See the header files of your components to see what exceptions are allowed to be thrown by the different methods. In most cases, this will be an `Exceptions::StrategyException (class Exceptions::StrategyException [exceptions/strategyexception.h])`. An example:

    	double BFClientSpecificRepository::getTimePassed() const throw(StrategyException) {
    		timespec dummy;
    		if (clock_gettime(CLOCK_REALTIME,&dummy))
    			throw StrategyException(string("Getting the passed time for a new shoot failed in \
    				Brotfrucht strategy: ")+strerror(errno));
    			return double(1000000000.0)*(dummy.tv_sec-_timerstart.tv_sec)+dummy.tv_nsec- \
    				_timerstart.tv_nsec;
    	}

One more useful tool to debug your strategy is the logger. Here an example from the Brotfrucht-Strategy:

    	_bfcsp->getLogger()->logMessage(3,string("This was collision number :")+_numberconf.str());

## Things not to forgot

Like every project, rtb team framework has several rules like coding standards, naming conventions, exception conventions, ... All information about writing proper code is contained in the sourceforge documentation manager. Here you will also find further details about the internal design of the framework, minutes of the meetings of the different groups and logs of irc sessions between the framework and strategy developers. At last we have the mailing list and a strategy forum to discuss all things related with rtb. Also take a look about our web site and the official realtime battle information (here you can find the documentation about the different messages sent by the Realtime Battle server and the commands a robot can send to it.