forked from TrueCloudLab/neoneo-go
Merge pull request #2872 from nspcc-dev/fix-missing-exception-in-applog
state: always marshal applog exception into JSON, fix #2869
This commit is contained in:
commit
40ef567527
1 changed files with 9 additions and 3 deletions
|
@ -218,7 +218,7 @@ type executionAux struct {
|
||||||
GasConsumed int64 `json:"gasconsumed,string"`
|
GasConsumed int64 `json:"gasconsumed,string"`
|
||||||
Stack json.RawMessage `json:"stack"`
|
Stack json.RawMessage `json:"stack"`
|
||||||
Events []NotificationEvent `json:"notifications"`
|
Events []NotificationEvent `json:"notifications"`
|
||||||
FaultException string `json:"exception,omitempty"`
|
FaultException *string `json:"exception"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements the json.Marshaler interface.
|
// MarshalJSON implements the json.Marshaler interface.
|
||||||
|
@ -235,13 +235,17 @@ func (e Execution) MarshalJSON() ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
var exception *string
|
||||||
|
if e.FaultException != "" {
|
||||||
|
exception = &e.FaultException
|
||||||
|
}
|
||||||
return json.Marshal(&executionAux{
|
return json.Marshal(&executionAux{
|
||||||
Trigger: e.Trigger.String(),
|
Trigger: e.Trigger.String(),
|
||||||
VMState: e.VMState.String(),
|
VMState: e.VMState.String(),
|
||||||
GasConsumed: e.GasConsumed,
|
GasConsumed: e.GasConsumed,
|
||||||
Stack: st,
|
Stack: st,
|
||||||
Events: e.Events,
|
Events: e.Events,
|
||||||
FaultException: e.FaultException,
|
FaultException: exception,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +284,9 @@ func (e *Execution) UnmarshalJSON(data []byte) error {
|
||||||
e.VMState = state
|
e.VMState = state
|
||||||
e.Events = aux.Events
|
e.Events = aux.Events
|
||||||
e.GasConsumed = aux.GasConsumed
|
e.GasConsumed = aux.GasConsumed
|
||||||
e.FaultException = aux.FaultException
|
if aux.FaultException != nil {
|
||||||
|
e.FaultException = *aux.FaultException
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue