Skip to content

Commit

Permalink
avoid nonsense exception messages. (#3063)
Browse files Browse the repository at this point in the history
Co-authored-by: Shargon <shargon@gmail.com>
  • Loading branch information
Jim8y and shargon committed Jan 10, 2024
1 parent e62e402 commit 3feca2a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Neo/Ledger/Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,12 @@ private void Persist(Block block)
using (ApplicationEngine engine = ApplicationEngine.Create(TriggerType.OnPersist, null, snapshot, block, system.Settings, 0))
{
engine.LoadScript(onPersistScript);
if (engine.Execute() != VMState.HALT) throw new InvalidOperationException();
if (engine.Execute() != VMState.HALT)
{
if (engine.FaultException != null)
throw engine.FaultException;
throw new InvalidOperationException();
}
ApplicationExecuted application_executed = new(engine);
Context.System.EventStream.Publish(application_executed);
all_application_executed.Add(application_executed);
Expand Down Expand Up @@ -438,7 +443,12 @@ private void Persist(Block block)
using (ApplicationEngine engine = ApplicationEngine.Create(TriggerType.PostPersist, null, snapshot, block, system.Settings, 0))
{
engine.LoadScript(postPersistScript);
if (engine.Execute() != VMState.HALT) throw new InvalidOperationException();
if (engine.Execute() != VMState.HALT)
{
if (engine.FaultException != null)
throw engine.FaultException;
throw new InvalidOperationException();
}
ApplicationExecuted application_executed = new(engine);
Context.System.EventStream.Publish(application_executed);
all_application_executed.Add(application_executed);
Expand Down

0 comments on commit 3feca2a

Please sign in to comment.