Skip to content

Commit 45a8241

Browse files
committed
Merge pull request #33 from crocuis/fix-except
fix exception
2 parents 70a4082 + 8eba2b6 commit 45a8241

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Plugins/UnrealJS/Source/V8/Private/Exception.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,23 @@ struct FV8Exception
1616
}
1717
else
1818
{
19-
auto filename = StringFromV8(message->GetScriptResourceName());
20-
auto linenum = message->GetLineNumber();
21-
auto line = StringFromV8(message->GetSourceLine());
19+
if (!exception.IsEmpty())
20+
{
21+
auto filename = StringFromV8(message->GetScriptResourceName());
22+
auto linenum = message->GetLineNumber();
23+
auto line = StringFromV8(message->GetSourceLine());
2224

23-
UE_LOG(Javascript, Error, TEXT("%s:%d: %s"), *filename, linenum, *exception);
25+
UE_LOG(Javascript, Error, TEXT("%s:%d: %s"), *filename, linenum, *exception);
2426

25-
auto stack_trace = StringFromV8(try_catch.StackTrace());
26-
if (stack_trace.Len() > 0)
27-
{
28-
TArray<FString> Lines;
29-
stack_trace.ParseIntoArrayLines(Lines);
30-
for (const auto& line : Lines)
27+
auto stack_trace = StringFromV8(try_catch.StackTrace());
28+
if (stack_trace.Len() > 0)
3129
{
32-
UE_LOG(Javascript, Error, TEXT("%s"), *line);
30+
TArray<FString> Lines;
31+
stack_trace.ParseIntoArrayLines(Lines);
32+
for (const auto& line : Lines)
33+
{
34+
UE_LOG(Javascript, Error, TEXT("%s"), *line);
35+
}
3336
}
3437
}
3538
}

0 commit comments

Comments
 (0)