mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +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);
|
||||
}
|
||||
catch (...)
|
||||
catch (const Sqrat::Exception & e)
|
||||
{
|
||||
// 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
|
||||
return -1;
|
||||
@ -394,13 +394,8 @@ Int32 Controller::Exec(Context & ctx)
|
||||
ctx.mBuffer.Write(0, e.what(), e.Message().size());
|
||||
// Specify that the command execution failed
|
||||
failed = true;
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
// Let's store the exception message
|
||||
ctx.mBuffer.WriteF(0, "Application exception occurred [%s]", e.what());
|
||||
// Specify that the command execution failed
|
||||
failed = true;
|
||||
// Call the debugger on this error and see if it can find anything
|
||||
Logger::Get().Debug("%s", e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -423,13 +418,8 @@ Int32 Controller::Exec(Context & ctx)
|
||||
ctx.mBuffer.Write(0, e.what(), e.Message().size());
|
||||
// Specify that the command execution failed
|
||||
failed = true;
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
// Let's store the exception message
|
||||
ctx.mBuffer.WriteF(0, "Application exception occurred [%s]", e.what());
|
||||
// Specify that the command execution failed
|
||||
failed = true;
|
||||
// Call the debugger on this error and see if it can find anything
|
||||
Logger::Get().Debug("%s", e.what());
|
||||
}
|
||||
}
|
||||
// Was there a runtime exception during the execution?
|
||||
@ -447,14 +437,11 @@ Int32 Controller::Exec(Context & ctx)
|
||||
}
|
||||
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
|
||||
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 = -1;
|
||||
@ -474,14 +461,11 @@ Int32 Controller::Exec(Context & ctx)
|
||||
}
|
||||
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
|
||||
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?
|
||||
@ -494,14 +478,11 @@ Int32 Controller::Exec(Context & ctx)
|
||||
}
|
||||
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
|
||||
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 ConvTo< Int32 >::From(result);
|
||||
|
Loading…
Reference in New Issue
Block a user