00001 /****************************************************************************** 00002 * Copyright (C) 2014 by Ralf Kaestner * 00003 * ralf.kaestner@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the Lesser GNU General Public License as published by* 00007 * the Free Software Foundation; either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * Lesser GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the Lesser GNU General Public License * 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00017 ******************************************************************************/ 00018 00019 #include <boost/lexical_cast.hpp> 00020 00021 #include "variant_topic_tools/Exceptions.h" 00022 00023 namespace variant_topic_tools { 00024 00025 /*****************************************************************************/ 00026 /* Constructors and Destructor */ 00027 /*****************************************************************************/ 00028 00029 NullPointerException::NullPointerException() : 00030 ros::Exception("Attempted null pointer operation") { 00031 } 00032 00033 InvalidOperationException::InvalidOperationException(const std::string& what) : 00034 ros::Exception("Attempted execution of an invalid operation: "+what) { 00035 } 00036 00037 InvalidDataTypeException::InvalidDataTypeException() : 00038 ros::Exception("Attempted use of an invalid data type") { 00039 } 00040 00041 ImmutableDataTypeException::ImmutableDataTypeException() : 00042 ros::Exception("Attempted modification of an immutable data type") { 00043 } 00044 00045 NoSuchDataTypeException::NoSuchDataTypeException(const std::string& 00046 identifier) : 00047 ros::Exception("Data type ["+identifier+"] does not exist") { 00048 } 00049 00050 AmbiguousDataTypeIdentifierException::AmbiguousDataTypeIdentifierException( 00051 const std::string& identifier) : 00052 ros::Exception("Data type identifier ["+identifier+ 00053 "] is used ambiguously") { 00054 } 00055 00056 DataTypeMismatchException::DataTypeMismatchException(const std::string& 00057 expectedDataType, const std::string& providedDataType) : 00058 ros::Exception("Provided data type ["+providedDataType+ 00059 "] mismatches expected data type ["+expectedDataType+"]") { 00060 } 00061 00062 AmbiguousMemberNameException::AmbiguousMemberNameException( 00063 const std::string& name) : 00064 ros::Exception("Member name ["+name+"] is used ambiguously") { 00065 } 00066 00067 NoSuchMemberException::NoSuchMemberException(int index) : 00068 ros::Exception("Member with index ["+boost::lexical_cast<std::string>(index)+ 00069 "] does not exist") { 00070 } 00071 00072 NoSuchMemberException::NoSuchMemberException(const std::string& name) : 00073 ros::Exception("Member with name ["+name+"] does not exist") { 00074 } 00075 00076 InvalidMessageMemberException::InvalidMessageMemberException() : 00077 ros::Exception("Attempted use of an invalid message member") { 00078 } 00079 00080 MD5SumMismatchException::MD5SumMismatchException(const std::string& 00081 expectedMD5Sum, const std::string& providedMD5Sum) : 00082 ros::Exception("Provided MD5 sum ["+providedMD5Sum+ 00083 "] mismatches expected MD5 sum ["+expectedMD5Sum+"]") { 00084 } 00085 00086 InvalidMessageTypeException::InvalidMessageTypeException(const std::string& 00087 invalidMessageType) : 00088 ros::Exception("Message type ["+invalidMessageType+"] is invalid") { 00089 } 00090 00091 MessageTypeMismatchException::MessageTypeMismatchException(const std::string& 00092 expectedMessageType, const std::string& providedMessageType) : 00093 ros::Exception("Provided message type ["+providedMessageType+ 00094 "] mismatches expected message type ["+expectedMessageType+"]") { 00095 } 00096 00097 DefinitionParseException::DefinitionParseException(const std::string& 00098 dataType, const std::string& line, const std::string& what) : 00099 ros::Exception("Error parsing the definition for ["+dataType+"]: "+ 00100 what+"\n"+line) { 00101 } 00102 00103 PackageNotFoundException::PackageNotFoundException(const std::string& 00104 package) : 00105 ros::Exception("Package ["+package+"] not found") { 00106 } 00107 00108 FileOpenException::FileOpenException(const std::string& filename) : 00109 ros::Exception("Error opening file ["+filename+"]") { 00110 } 00111 00112 InvalidSerializerException::InvalidSerializerException() : 00113 ros::Exception("Attempted use of an invalid serializer") { 00114 } 00115 00116 }