Skip to content

Commit

Permalink
Merge pull request #9 from neo-project/master
Browse files Browse the repository at this point in the history
m
  • Loading branch information
陈志同 authored Nov 23, 2020
2 parents 6828062 + f0a3ab6 commit a59d9ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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;
}
}
}
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer.SmartContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void SerializeUnsigned(BinaryWriter writer)

private JObject GetInvokeResult(byte[] script, Signers signers = null)
{
Transaction tx = new Transaction
Transaction tx = signers == null ? null : new Transaction
{
Signers = signers?.GetSigners(),
Attributes = Array.Empty<TransactionAttribute>(),
Expand Down

0 comments on commit a59d9ae

Please sign in to comment.