1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Do a better job of extracting the error sting from the thrown object.

This commit is contained in:
Sandu Liviu Catalin 2019-05-01 16:04:29 +03:00
parent 159f491ad2
commit 05159b5558

View File

@ -832,16 +832,16 @@ SQInteger Core::RuntimeErrorHandler(HSQUIRRELVM vm)
{
return SQ_OK; // No error to display!
}
// Temporary variable for the thrown error
CSStr err_msg = nullptr;
// Attempt to obtain the thrown value as a string
if (SQ_SUCCEEDED(sq_getstring(vm, 2, &err_msg)))
// Attempt to generate the string value
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.Proc(false)))
{
Logger::Get().Debug(_SC("%s"), err_msg);
Logger::Get().Debug(_SC("Unknown runtime error has occurred"));
}
else
{
Logger::Get().Debug(_SC("Unknown runtime error has occurred"));
Logger::Get().Debug(_SC("%s"), val.mPtr);
}
// We handled the error
return SQ_OK;