00001 /* sbuild-error - sbuild error handling 00002 * 00003 * Copyright © 2005 Roger Leigh <rleigh@debian.org> 00004 * 00005 * serror is free software; you can redistribute it and/or modify it 00006 * under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * serror is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00018 * MA 02111-1307 USA 00019 * 00020 *********************************************************************/ 00021 00022 #ifndef SBUILD_ERROR_H 00023 #define SBUILD_ERROR_H 00024 00025 #include <stdexcept> 00026 00027 #include <boost/format.hpp> 00028 00029 namespace sbuild 00030 { 00031 00035 class runtime_error : public std::runtime_error 00036 { 00037 public: 00043 runtime_error(const std::string& error): 00044 std::runtime_error(error) 00045 {} 00046 00048 virtual ~runtime_error() throw () 00049 {} 00050 }; 00051 00055 template <typename T> 00056 class runtime_error_custom : public runtime_error 00057 { 00058 public: 00064 runtime_error_custom(const std::string& error): 00065 runtime_error(error) 00066 {} 00067 00073 runtime_error_custom(const boost::format& error): 00074 runtime_error(error.str()) 00075 {} 00076 00078 virtual ~runtime_error_custom() throw () 00079 {} 00080 }; 00081 00082 } 00083 00084 #endif /* SBUILD_ERROR_H */ 00085 00086 /* 00087 * Local Variables: 00088 * mode:C++ 00089 * End: 00090 */