ExceptionDefine.hh

Go to the documentation of this file.
00001 /*
00002 ** TowBowlTactics, an adaptation of the tabletop game Blood Bowl.
00003 ** 
00004 ** Copyright (C) 2006 The TBT Team.
00005 ** 
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 ** 
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 ** 
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
00015 */
00016 
00017 #ifndef EXCEPTIONDEFINE_HH_
00018 # define EXCEPTIONDEFINE_HH_
00019 
00028 
00029 
00030 
00031 # define THROW(Excpt, Msg)                      \
00032 do {                                            \
00033   std::ostringstream os;                        \
00034   os << Msg;                                    \
00035   throw Excpt(os.rdbuf()->str());               \
00036 } while (0)
00037 
00038 # define PRINT_AND_THROW(Excpt, Msg)            \
00039 do {                                            \
00040   std::ostringstream os;                        \
00041   os << Msg;                                    \
00042   Excpt e(os.rdbuf()->str());                   \
00043   ERR("Throwing " #Excpt ": %1", e.what());     \
00044   throw e;                                      \
00045 } while (0)
00046 
00048 
00049 #endif /* !EXCEPTIONDEFINE_HH_ */

Generated on Sat Jun 23 16:07:23 2007 for Stechec/TBT by  doxygen 1.4.7