mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-21 20:27:13 +01:00
Adjust the command execution to invoke the debugger and perform a traceback when catching script exceptions.
Don't catch application exceptions because in command execution because they probably left the stack in an invalid state and the server should be allowed to crash.
This commit is contained in:
parent
e76026eae3
commit
5d518ef479
@ -285,10 +285,10 @@ Int32 Controller::Run(const Guard & guard, CCStr command)
|
|||||||
{
|
{
|
||||||
return Exec(ctx);
|
return Exec(ctx);
|
||||||
}
|
}
|
||||||
catch (...)
|
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_EXECUTION_FAILED, _SC("Exceptions occurred during execution"), ctx.mInvoker);
|
SqError(CMDERR_EXECUTION_FAILED, _SC("Exceptions occurred during execution"), e.what());
|
||||||
}
|
}
|
||||||
// Execution failed
|
// Execution failed
|
||||||
return -1;
|
return -1;
|
||||||
@ -394,13 +394,8 @@ Int32 Controller::Exec(Context & ctx)
|
|||||||
ctx.mBuffer.Write(0, e.what(), 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;
|
||||||
}
|
// Call the debugger on this error and see if it can find anything
|
||||||
catch (const std::exception & e)
|
Logger::Get().Debug("%s", e.what());
|
||||||
{
|
|
||||||
// Let's store the exception message
|
|
||||||
ctx.mBuffer.WriteF(0, "Application exception occurred [%s]", e.what());
|
|
||||||
// Specify that the command execution failed
|
|
||||||
failed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -423,13 +418,8 @@ Int32 Controller::Exec(Context & ctx)
|
|||||||
ctx.mBuffer.Write(0, e.what(), 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;
|
||||||
}
|
// Call the debugger on this error and see if it can find anything
|
||||||
catch (const std::exception & e)
|
Logger::Get().Debug("%s", e.what());
|
||||||
{
|
|
||||||
// Let's store the exception message
|
|
||||||
ctx.mBuffer.WriteF(0, "Application exception occurred [%s]", e.what());
|
|
||||||
// Specify that the command execution failed
|
|
||||||
failed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Was there a runtime exception during the execution?
|
// Was there a runtime exception during the execution?
|
||||||
@ -447,14 +437,11 @@ Int32 Controller::Exec(Context & ctx)
|
|||||||
}
|
}
|
||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
|
// Call the debugger on this error and see if it can find anything
|
||||||
|
Logger::Get().Debug("%s", e.what());
|
||||||
// Tell the script callback to deal with the error
|
// Tell the script callback to deal with the error
|
||||||
SqError(CMDERR_UNRESOLVED_FAILURE, _SC("Unable to resolve command failure"), e.Message());
|
SqError(CMDERR_UNRESOLVED_FAILURE, _SC("Unable to resolve command failure"), e.Message());
|
||||||
}
|
}
|
||||||
catch (const std::exception & e)
|
|
||||||
{
|
|
||||||
// Tell the script callback to deal with the error
|
|
||||||
SqError(CMDERR_UNRESOLVED_FAILURE, _SC("Unable to resolve command failure"), e.what());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Result is invalid at this point
|
// Result is invalid at this point
|
||||||
result = -1;
|
result = -1;
|
||||||
@ -474,14 +461,11 @@ Int32 Controller::Exec(Context & ctx)
|
|||||||
}
|
}
|
||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
|
// Call the debugger on this error and see if it can find anything
|
||||||
|
Logger::Get().Debug("%s", e.what());
|
||||||
// Tell the script callback to deal with the error
|
// Tell the script callback to deal with the error
|
||||||
SqError(CMDERR_UNRESOLVED_FAILURE, _SC("Unable to resolve command failure"), e.Message());
|
SqError(CMDERR_UNRESOLVED_FAILURE, _SC("Unable to resolve command failure"), e.Message());
|
||||||
}
|
}
|
||||||
catch (const std::exception & e)
|
|
||||||
{
|
|
||||||
// Tell the script callback to deal with the error
|
|
||||||
SqError(CMDERR_UNRESOLVED_FAILURE, _SC("Unable to resolve command failure"), e.what());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Is there a callback that must be executed after a successful execution?
|
// Is there a callback that must be executed after a successful execution?
|
||||||
@ -494,14 +478,11 @@ Int32 Controller::Exec(Context & ctx)
|
|||||||
}
|
}
|
||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
|
// Call the debugger on this error and see if it can find anything
|
||||||
|
Logger::Get().Debug("%s", e.what());
|
||||||
// Tell the script callback to deal with the error
|
// Tell the script callback to deal with the error
|
||||||
SqError(CMDERR_POST_PROCESSING_FAILED, _SC("Unable to complete command post processing"), e.Message());
|
SqError(CMDERR_POST_PROCESSING_FAILED, _SC("Unable to complete command post processing"), e.Message());
|
||||||
}
|
}
|
||||||
catch (const std::exception & e)
|
|
||||||
{
|
|
||||||
// Tell the script callback to deal with the error
|
|
||||||
SqError(CMDERR_POST_PROCESSING_FAILED, _SC("Unable to complete command post processing"), e.what());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Return the result
|
// Return the result
|
||||||
return ConvTo< Int32 >::From(result);
|
return ConvTo< Int32 >::From(result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user