Renamed sol_error to error

This commit is contained in:
Rapptz 2014-05-21 22:24:15 -04:00
parent 559a77564e
commit 932e29a841
5 changed files with 12 additions and 12 deletions

View File

@ -19,17 +19,17 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef SOL_ERROR_HPP
#define SOL_ERROR_HPP
#ifndef error_HPP
#define error_HPP
#include <stdexcept>
#include <string>
namespace sol {
class sol_error : public std::runtime_error {
class error : public std::runtime_error {
public:
sol_error(const std::string& str) noexcept: std::runtime_error("sol: error: " + str) {}
error(const std::string& str) noexcept: std::runtime_error("lua: error: " + str) {}
};
} // sol
#endif // SOL_ERROR_HPP
#endif // error_HPP

View File

@ -106,7 +106,7 @@ struct static_member_function {
struct base_function {
static int base_call(lua_State* L, void* inheritancedata) {
if (inheritancedata == nullptr) {
throw sol_error("call from Lua to C++ function has null data");
throw error("call from Lua to C++ function has null data");
}
base_function* pfx = static_cast<base_function*>(inheritancedata);
@ -117,7 +117,7 @@ struct base_function {
static int base_gc(lua_State*, void* udata) {
if (udata == nullptr) {
throw sol_error("call from lua to C++ gc function with null data");
throw error("call from lua to C++ gc function with null data");
}
base_function* ptr = static_cast<base_function*>(udata);
@ -145,7 +145,7 @@ struct base_function {
};
virtual int operator()(lua_State*) {
throw sol_error("failure to call specialized wrapped C++ function from Lua");
throw error("failure to call specialized wrapped C++ function from Lua");
}
virtual ~base_function() {}
@ -242,7 +242,7 @@ struct userdata_function : public base_function {
void prepare(lua_State* L) {
void* udata = stack::get<userdata_t>(L, 1);
if (udata == nullptr)
throw sol_error("must use the syntax [object]:[function] to call member functions bound to C++");
throw error("must use the syntax [object]:[function] to call member functions bound to C++");
item = static_cast<T*>(udata);
}

View File

@ -35,7 +35,7 @@ namespace stack {
namespace detail {
inline nil_t get(types<nil_t>, lua_State* L, int index = -1) {
if (lua_isnil(L, index) == 0)
throw sol::sol_error("not nil");
throw sol::error("not nil");
return nil_t{ };
}

View File

@ -36,7 +36,7 @@ struct are_same<T, U, Args...> : std::integral_constant<bool, std::is_same<T, U>
inline int atpanic(lua_State* L) {
std::string err = lua_tostring(L, -1);
throw sol_error(err);
throw error(err);
}
} // detail

View File

@ -68,7 +68,7 @@ private:
}
static void match_constructor(lua_State*, T*, call_syntax, int) {
throw sol_error("No matching constructor for the arguments provided");
throw error("No matching constructor for the arguments provided");
}
template<typename ...CArgs, typename... Args>