Fix exception handling for PDT operator.

This commit is contained in:
2022-10-31 13:47:10 +08:00
parent 92a49294f7
commit d85553a93b
2 changed files with 4 additions and 2 deletions

View File

@@ -47,12 +47,12 @@ namespace Cryville.Common.Pdt {
internal void Call(byte* prmem, bool noset) {
_prmem = prmem;
_rfreq = false;
Execute();
if (!_rfreq && !noset) throw new InvalidOperationException("Return frame not set");
try { Execute(); } catch (Exception) { _failure = true; }
if (_failure) {
if (_rfreq) _etor.DiscardStack();
throw new InvalidOperationException("Evaluation failed");
}
if (!_rfreq && !noset) throw new InvalidOperationException("Return frame not set");
}
/// <summary>
/// Executes the operator.