Skip to content

Commit

Permalink
Update LogReader.cs (neo-project#401)
Browse files Browse the repository at this point in the history
* Update LogReader.cs

* update
  • Loading branch information
陈志同 authored and joeqian10 committed Apr 7, 2021
1 parent ee6c93c commit f9575ba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ApplicationLogs/LogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void OnPersist(StoreView snapshot, IReadOnlyList<Blockchain.ApplicationEx
JObject trigger = new JObject();
trigger["trigger"] = appExec.Trigger;
trigger["vmstate"] = appExec.VMState;
trigger["exception"] = GetExceptionMessage(appExec.Exception);
trigger["gasconsumed"] = appExec.GasConsumed.ToString();
try
{
Expand Down Expand Up @@ -150,5 +151,17 @@ public bool ShouldThrowExceptionFromCommit(Exception ex)
{
return false;
}

string GetExceptionMessage(Exception exception)
{
if (exception == null) return "Engine faulted.";

if (exception.InnerException != null)
{
return GetExceptionMessage(exception.InnerException);
}

return exception.Message;
}
}
}

0 comments on commit f9575ba

Please sign in to comment.