Skip to content

Better error message when failing to decode cadence json #4209

@bjartek

Description

@bjartek

Current Behavior

When json.Decode fails with a missing field it does not include context

panic: failed to decode JSON-Cadence value: missing property: type

This is returned if a type is missing in any representation within decoding a flow transaction from json

see onflow/flow-cli#2045 for relevant bug

Expected Behavior

It would be nice if it where possible to get a better error message that had some more context of where this error happend.

Steps To Reproduce

see onflow/flow-cli#2045

Environment

- Cadence version: v1.7.0
- Network: mainnet

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions