Open wledfor2 opened 7 years ago
The issue isn't just NUnit. It happens when any exception but ScriptRuntimeException is thrown.
//this works
public DynValue Catch(DynValue testDelegate, DynValue message) {
Exception e = null;
try {
testDelegate.Function.Call();
} catch(Exception ex) {
e = ex;
}
if (e == null) {
throw new ScriptRuntimeException(message.CastToString());
}
return DynValue.NewTuple(DynValue.NewString(e.GetType().Name), DynValue.NewString(e.Message));
}
//this does not work
public DynValue Catch(DynValue testDelegate, DynValue message) {
Exception e = null;
try {
testDelegate.Function.Call();
} catch(Exception ex) {
e = ex;
}
if (e == null) {
throw new Exception(message.CastToString());
}
return DynValue.NewTuple(DynValue.NewString(e.GetType().Name), DynValue.NewString(e.Message));
}
I'm not sure what's going on here.
I was writing a wrapper around NUnit's assert functions, I encountered a strange issue. When running the following code:
The following exception is produced:
When changing the Lua code to this, it works as expected:
or
and accept return values from DoString, the results are as expected.