00001 /******************************************************************************\ 00002 * LuaExceptions.hpp * 00003 * Exceptions related to Lua errors. * 00004 * * 00005 * * 00006 * Copyright (C) 2005-2007 by Leandro Motta Barros. * 00007 * * 00008 * Permission is hereby granted, free of charge, to any person obtaining a copy * 00009 * of this software and associated documentation files (the "Software"), to * 00010 * deal in the Software without restriction, including without limitation the * 00011 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * 00012 * sell copies of the Software, and to permit persons to whom the Software is * 00013 * furnished to do so, subject to the following conditions: * 00014 * * 00015 * The above copyright notice and this permission notice shall be included in * 00016 * all copies or substantial portions of the Software. * 00017 * * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 00019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 00020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 00021 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 00022 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 00023 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * 00024 * IN THE SOFTWARE. * 00025 \******************************************************************************/ 00026 00027 #ifndef _DILUCULUM_LUA_EXCEPTIONS_HPP_ 00028 #define _DILUCULUM_LUA_EXCEPTIONS_HPP_ 00029 00030 #include <stdexcept> 00031 #include <Diluculum/Types.hpp> 00032 #include <Diluculum/LuaValue.hpp> 00033 00034 00035 namespace Diluculum 00036 { 00038 class LuaError: public std::runtime_error 00039 { 00040 public: 00044 LuaError (const char* what) 00045 : std::runtime_error (what) 00046 { } 00047 }; 00048 00049 00050 00052 class LuaRunTimeError: public LuaError 00053 { 00054 public: 00059 LuaRunTimeError (const char* what) 00060 : LuaError (what) 00061 { } 00062 }; 00063 00064 00065 00067 class LuaFileError: public LuaError 00068 { 00069 public: 00073 LuaFileError (const char* what) 00074 : LuaError (what) 00075 { } 00076 }; 00077 00078 00079 00081 class LuaSyntaxError: public LuaError 00082 { 00083 public: 00088 LuaSyntaxError (const char* what) 00089 : LuaError (what) 00090 { } 00091 }; 00092 00093 00094 00096 class LuaMemoryError: public LuaError 00097 { 00098 public: 00102 LuaMemoryError (const char* what) 00103 : LuaError (what) 00104 { } 00105 }; 00106 00107 00108 00110 class LuaErrorError: public LuaError 00111 { 00112 public: 00116 LuaErrorError (const char* what) 00117 : LuaError (what) 00118 { } 00119 }; 00120 00121 00122 00124 class LuaTypeError: public LuaError 00125 { 00126 public: 00130 LuaTypeError (const char* what) 00131 : LuaError (what) 00132 { } 00133 }; 00134 00135 00136 00140 class TypeMismatchError: public LuaError 00141 { 00142 public: 00147 TypeMismatchError (const std::string& expectedType, 00148 const std::string& foundType); 00149 00156 ~TypeMismatchError() throw() { }; 00157 00159 std::string getExpectedType() const { return expectedType_; } 00160 00162 std::string getFoundType() const { return foundType_; } 00163 00164 private: 00166 std::string expectedType_; 00167 00169 std::string foundType_; 00170 }; 00171 00172 } // namespace Diluculum 00173 00174 00175 #endif // _DILUCULUM_LUA_EXCEPTIONS_HPP_
1.4.6