Skip to content

Commit

Permalink
feat(shared): re-throw exception thrown inside Entity Factories
Browse files Browse the repository at this point in the history
  • Loading branch information
xLuxy committed Jan 18, 2024
1 parent f9d1027 commit fe2dc17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions shared/src/modules/SharedCppBindingsModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down

0 comments on commit fe2dc17

Please sign in to comment.