00001 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ 00002 /* 00003 * mitie 00004 * Copyright (C) Jason Spencer 2009 <mitie@jasonspencer.org> 00005 * 00006 * mitie is free software: you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * mitie is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00014 * See the GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #ifndef _CJNETWORKPROCESSEXCEPTION_H_ 00021 #define _CJNETWORKPROCESSEXCEPTION_H_ 1 00022 00023 #include <exception> 00024 #include <string> 00025 #include "Cj_options_helper.hh" 00026 00027 namespace jmitie { 00028 00029 class CjNetworkProcessException { }; // just an interface to label/tag exceptions that we've part handled 00030 00031 class CjNP_MemoryAllocFail : public CjNetworkProcessException, public std::bad_alloc { 00032 public: 00033 explicit CjNP_MemoryAllocFail() {} 00034 }; 00035 00036 class CjNP_selectionFail : public CjNetworkProcessException, public std::runtime_error { 00037 public: 00038 explicit CjNP_selectionFail (const std::string& message) : std::runtime_error(message) {} 00039 virtual ~CjNP_selectionFail() throw() {} 00040 }; 00041 00042 class CjNP_parseFail : public CjNetworkProcessException, public Cj_OptionParseFail { 00043 public: 00044 explicit CjNP_parseFail (const std::string& message):Cj_OptionParseFail(message) {} 00045 virtual ~CjNP_parseFail() throw() {} 00046 }; 00047 00048 } // namespace jmitie 00049 00050 #endif // _CJNETWORKPROCESSEXCEPTION_H_