Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
f15f63ae
Commit
f15f63ae
authored
Sep 02, 2021
by
Erik Nilsen Haga
Committed by
Vinicius Jarina
Sep 08, 2021
Browse files
Wrap invokation in try catch.
parent
8498b6fb
Changes
1
Show whitespace changes
Inline
Side-by-side
src/Metatables.cs
View file @
f15f63ae
...
@@ -1301,7 +1301,8 @@ namespace NLua
...
@@ -1301,7 +1301,8 @@ namespace NLua
if
(
isOk
)
if
(
isOk
)
{
{
object
result
;
object
result
;
try
{
if
(
methodDelegate
.
IsStatic
)
if
(
methodDelegate
.
IsStatic
)
result
=
methodDelegate
.
Invoke
(
null
,
validDelegate
.
args
);
result
=
methodDelegate
.
Invoke
(
null
,
validDelegate
.
args
);
else
else
...
@@ -1310,6 +1311,18 @@ namespace NLua
...
@@ -1310,6 +1311,18 @@ namespace NLua
_translator
.
Push
(
luaState
,
result
);
_translator
.
Push
(
luaState
,
result
);
return
1
;
return
1
;
}
}
catch
(
TargetInvocationException
e
)
{
// Failure of method invocation
if
(
_translator
.
interpreter
.
UseTraceback
)
e
.
GetBaseException
().
Data
[
"Traceback"
]
=
_translator
.
interpreter
.
GetDebugTraceback
();
return
_translator
.
Interpreter
.
SetPendingException
(
e
.
GetBaseException
());
}
catch
(
Exception
e
)
{
return
_translator
.
Interpreter
.
SetPendingException
(
e
);
}
}
_translator
.
ThrowError
(
luaState
,
"Cannot invoke delegate (invalid arguments for "
+
methodDelegate
.
Name
+
")"
);
_translator
.
ThrowError
(
luaState
,
"Cannot invoke delegate (invalid arguments for "
+
methodDelegate
.
Name
+
")"
);
return
1
;
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment