Improve script exception error message.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -113,4 +113,5 @@ void AngelScripResolver::FinalizeModule() {
|
||||
void AngelScripResolver::CreateScript(ScriptCategory category, const char* scriptName) {
|
||||
auto scriptString = _loadFunc(category, scriptName);
|
||||
_mainModule->AddScriptSection(scriptName, scriptString);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
ContextPool* GetContextPool() { return _ctxPool; }
|
||||
|
||||
#define CALL_HOOK(name, setup) \
|
||||
#define CALL_HOOK(name, setup) \
|
||||
auto s = _type->Get##name(); \
|
||||
if (!s.Exists) \
|
||||
return; \
|
||||
@@ -45,7 +45,13 @@ public:
|
||||
ctx->SetObject(_obj); \
|
||||
setup; \
|
||||
auto scriptResult = ctx->Execute(); \
|
||||
if (scriptResult != 0) { \
|
||||
if (scriptResult != asEXECUTION_FINISHED) { \
|
||||
if (scriptResult == asEXECUTION_EXCEPTION) { \
|
||||
std::stringstream err; \
|
||||
err << "Script exception in script '" << GetName() << "', line " << ctx->GetExceptionLineNumber() \
|
||||
<< ". Message: '" << ctx->GetExceptionString() << "'."; \
|
||||
throw CreatureException(err.str()); \
|
||||
} \
|
||||
throw CreatureException("Script didn't finish properly; message " + std::to_string(scriptResult)); \
|
||||
} \
|
||||
if (newContext) { \
|
||||
|
||||
Reference in New Issue
Block a user