1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-31 09:57:14 +01:00

Adjust the code to use the .what() method from the Sqrat exception.

This commit is contained in:
Sandu Liviu Catalin 2016-07-09 14:18:09 +03:00
parent 862c09150f
commit 7bb0d5f947
12 changed files with 37 additions and 37 deletions

View File

@ -699,7 +699,7 @@ void Session::ForwardEvent(Function & listener, CCStr event, CCStr origin, CCStr
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
SqMod_LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str()); SqMod_LogErr("IRC event [%s] => Squirrel error [%s]", event, e.what());
} }
catch (const std::exception & e) catch (const std::exception & e)
{ {
@ -743,7 +743,7 @@ void Session::ForwardEvent(Function & listener, Uint32 event,
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
SqMod_LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str()); SqMod_LogErr("IRC event [%s] => Squirrel error [%s]", event, e.what());
} }
catch (const std::exception & e) catch (const std::exception & e)
{ {
@ -1014,7 +1014,7 @@ SQInteger Session::CmdMsgF(HSQUIRRELVM vm)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Propagate the error // Propagate the error
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid session instance? // Do we have a valid session instance?
if (!session) if (!session)
@ -1078,7 +1078,7 @@ SQInteger Session::CmdMeF(HSQUIRRELVM vm)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Propagate the error // Propagate the error
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid session instance? // Do we have a valid session instance?
if (!session) if (!session)
@ -1142,7 +1142,7 @@ SQInteger Session::CmdNoticeF(HSQUIRRELVM vm)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Propagate the error // Propagate the error
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid session instance? // Do we have a valid session instance?
if (!session) if (!session)

View File

@ -363,7 +363,7 @@ SQInteger Connection::ExecF(HSQUIRRELVM vm)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Propagate the error // Propagate the error
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid connection instance? // Do we have a valid connection instance?
if (!conn) if (!conn)
@ -414,7 +414,7 @@ SQInteger Connection::QueueF(HSQUIRRELVM vm)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Propagate the error // Propagate the error
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid connection instance? // Do we have a valid connection instance?
if (!conn) if (!conn)
@ -458,7 +458,7 @@ SQInteger Connection::QueryF(HSQUIRRELVM vm)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Propagate the error // Propagate the error
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid connection instance? // Do we have a valid connection instance?
if (!conn) if (!conn)
@ -484,7 +484,7 @@ SQInteger Connection::QueryF(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// This function returned a value // This function returned a value
return 1; return 1;

View File

@ -127,7 +127,7 @@ Int32 ConnHnd::Flush(Uint32 num, Object & env, Function & func)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
SqMod_LogErr("Squirrel error caught in flush handler [%s]", e.Message().c_str()); SqMod_LogErr("Squirrel error caught in flush handler [%s]", e.what());
} }
catch (const std::exception & e) catch (const std::exception & e)
{ {

View File

@ -208,7 +208,7 @@ Int32 Controller::Run(const Guard & guard, CCStr command)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Tell the script callback to deal with the error // Tell the script callback to deal with the error
SqError(CMDERR_INVALID_COMMAND, e.Message().c_str(), guard.mCurrent->mInvoker); SqError(CMDERR_INVALID_COMMAND, e.what(), guard.mCurrent->mInvoker);
// Execution failed! // Execution failed!
return -1; return -1;
} }
@ -350,7 +350,7 @@ Int32 Controller::Exec(Context & ctx)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Let's store the exception message // Let's store the exception message
ctx.mBuffer.Write(0, e.Message().c_str(), e.Message().size()); ctx.mBuffer.Write(0, e.what(), e.Message().size());
// Specify that the command execution failed // Specify that the command execution failed
failed = true; failed = true;
} }
@ -379,7 +379,7 @@ Int32 Controller::Exec(Context & ctx)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Let's store the exception message // Let's store the exception message
ctx.mBuffer.Write(0, e.Message().c_str(), e.Message().size()); ctx.mBuffer.Write(0, e.what(), e.Message().size());
// Specify that the command execution failed // Specify that the command execution failed
failed = true; failed = true;
} }

View File

@ -394,7 +394,7 @@ protected:
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// We can only log this incident and in the future maybe also include the location // We can only log this incident and in the future maybe also include the location
LogErr("Command error callback failed [%s]", e.Message().c_str()); LogErr("Command error callback failed [%s]", e.what());
} }
} }

View File

@ -518,7 +518,7 @@ bool Core::LoadScript(CSStr filepath, bool delay)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
LogErr("Unable to load script: %s", e.Message().c_str()); LogErr("Unable to load script: %s", e.what());
// Failed to load // Failed to load
return false; return false;
} }

View File

@ -1673,7 +1673,7 @@ SQInteger CPlayer::Msg(HSQUIRRELVM vm)
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
// Propagate the error // Propagate the error
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid player instance? // Do we have a valid player instance?
@ -1747,7 +1747,7 @@ SQInteger CPlayer::MsgP(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid player instance? // Do we have a valid player instance?
@ -1770,7 +1770,7 @@ SQInteger CPlayer::MsgP(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Perform a range check on the specified prefix index // Perform a range check on the specified prefix index
@ -1841,7 +1841,7 @@ SQInteger CPlayer::MsgEx(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid player instance? // Do we have a valid player instance?
@ -1864,7 +1864,7 @@ SQInteger CPlayer::MsgEx(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Perform a range check on the specified prefix index // Perform a range check on the specified prefix index
@ -1937,7 +1937,7 @@ SQInteger CPlayer::Message(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid player instance? // Do we have a valid player instance?
@ -1994,7 +1994,7 @@ SQInteger CPlayer::Announce(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Do we have a valid player instance? // Do we have a valid player instance?
@ -2064,7 +2064,7 @@ SQInteger CPlayer::AnnounceEx(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what()));
} }
// Do we have a valid player instance? // Do we have a valid player instance?

View File

@ -191,7 +191,7 @@ static SQInteger SqNanL(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (const std::exception e) catch (const std::exception e)
{ {
@ -696,7 +696,7 @@ static SQInteger SqRoundL(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (const std::exception e) catch (const std::exception e)
{ {

View File

@ -83,7 +83,7 @@ static SQInteger SqLeftStr(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (...) catch (...)
{ {
@ -182,7 +182,7 @@ static SQInteger SqLeftOffsetStr(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (...) catch (...)
{ {
@ -274,7 +274,7 @@ static SQInteger SqRightStr(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (...) catch (...)
{ {
@ -373,7 +373,7 @@ static SQInteger SqRightOffsetStr(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (...) catch (...)
{ {
@ -460,7 +460,7 @@ static SQInteger SqCenterStr(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (...) catch (...)
{ {
@ -1096,7 +1096,7 @@ static SQInteger SqStrExplode(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
catch (...) catch (...)
{ {

View File

@ -76,7 +76,7 @@ void UnbindCallbacks();
*/ catch (const Sqrat::Exception & e) /* */ catch (const Sqrat::Exception & e) /*
*/ { /* */ { /*
*/ LogErr("Squirrel exception caught (" #ev ") event"); /* */ LogErr("Squirrel exception caught (" #ev ") event"); /*
*/ LogInf("Message: %s", e.Message().c_str()); /* */ LogInf("Message: %s", e.what()); /*
*/ } /* */ } /*
*/ catch (const std::exception & e) /* */ catch (const std::exception & e) /*
*/ { /* */ { /*

View File

@ -51,7 +51,7 @@ SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
} }
// The message starts right after the color // The message starts right after the color
@ -328,7 +328,7 @@ static SQInteger SqBroadcastMsgP(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Perform a range check on the specified prefix index // Perform a range check on the specified prefix index
@ -421,7 +421,7 @@ static SQInteger SqBroadcastMsgEx(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Perform a range check on the specified prefix index // Perform a range check on the specified prefix index
@ -637,7 +637,7 @@ static SQInteger SqBroadcastAnnounceEx(HSQUIRRELVM vm)
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
return sq_throwerror(vm, e.Message().c_str()); return sq_throwerror(vm, e.what());
} }
// Attempt to generate the string value // Attempt to generate the string value

View File

@ -322,7 +322,7 @@ void Routine::Execute()
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {
LogErr("Routine [%s] => Squirrel error [%s]", m_Tag.c_str(), e.Message().c_str()); LogErr("Routine [%s] => Squirrel error [%s]", m_Tag.c_str(), e.what());
} }
catch (const std::exception & e) catch (const std::exception & e)
{ {