00001 /* vim: set et sw=3 tw=0 fo=croqlaw cino=t0: 00002 * 00003 * Astxx, the Asterisk C++ API and Utility Library. 00004 * Copyright (C) 2005-2007 Matthew A. Nicholson 00005 * Copyright (C) 2005-2007 Digium, Inc. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License version 2.1 as published by the Free Software Foundation. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00028 #ifndef ASTXX_MANAGER_ERROR_H 00029 #define ASTXX_MANAGER_ERROR_H 00030 00031 #include <astxx/exception.h> 00032 #include <string> 00033 00034 namespace astxx { 00035 namespace manager { 00036 00038 class error : public astxx::exception { 00039 public: 00040 error() throw() : astxx::exception("Manager Error") { } 00041 explicit error(const std::string& desc) throw() : astxx::exception(desc) { } 00042 }; 00043 00045 class parse_error : public manager::error { 00046 public: 00047 parse_error() throw() : manager::error("parse error") { } 00048 explicit parse_error(const std::string& desc) throw() : manager::error(desc) { } 00049 }; 00050 00052 class empty_header : public parse_error { 00053 public: 00054 empty_header() throw() : parse_error("empty header recieved") { } 00055 }; 00056 00058 class unknown_message : public parse_error { 00059 public: 00060 explicit unknown_message(const std::string& desc) throw() : parse_error("unknown message type: " + desc), m_type(desc) { } 00061 ~unknown_message() throw() { } 00062 00064 std::string type() const { return m_type; } 00065 private: 00066 std::string m_type; 00067 }; 00068 00072 extern const char* permission_error_string; 00073 00077 extern const char* authentication_error_string; 00078 00080 class permission_denied : public manager::error { 00081 public: 00082 explicit permission_denied() throw() : manager::error(permission_error_string) { } 00083 }; 00084 00086 class authentication_required : public manager::error { 00087 public: 00088 explicit authentication_required() throw() : manager::error(authentication_error_string) { } 00089 }; 00090 00091 } 00092 } 00093 00094 #endif
1.5.6