1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +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! return SQ_OK; // No error to display!
} }
// Temporary variable for the thrown error // Attempt to generate the string value
CSStr err_msg = nullptr; StackStrF val(vm, 2);
// Attempt to obtain the thrown value as a string // Have we failed to retrieve the string?
if (SQ_SUCCEEDED(sq_getstring(vm, 2, &err_msg))) if (SQ_FAILED(val.Proc(false)))
{ {
Logger::Get().Debug(_SC("%s"), err_msg); Logger::Get().Debug(_SC("Unknown runtime error has occurred"));
} }
else else
{ {
Logger::Get().Debug(_SC("Unknown runtime error has occurred")); Logger::Get().Debug(_SC("%s"), val.mPtr);
} }
// We handled the error // We handled the error
return SQ_OK; return SQ_OK;