From fe2dc17ffd71db1b909ade3b1b6886ef736d2c79 Mon Sep 17 00:00:00 2001 From: xLuxy <67131061+xLuxy@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:31:56 +0100 Subject: [PATCH] feat(shared): re-throw exception thrown inside Entity Factories --- shared/src/modules/SharedCppBindingsModule.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shared/src/modules/SharedCppBindingsModule.cpp b/shared/src/modules/SharedCppBindingsModule.cpp index 3b0260b5d..8c4305d62 100644 --- a/shared/src/modules/SharedCppBindingsModule.cpp +++ b/shared/src/modules/SharedCppBindingsModule.cpp @@ -63,6 +63,13 @@ static void CreateEntity(js::FunctionContext& ctx) { js::TryCatch tryCatch; alt::IBaseObject* object = js::FactoryHandler::Create(type, args); + + if (tryCatch.HasCaught()) + { + tryCatch.ReThrow(); + return; + } + if(!object) { if(!tryCatch.HasCaught()) ctx.Throw("Failed to create entity of type " + std::string(magic_enum::enum_name(type)));