We could improve the error reporting when converting JSON parameters to binary using a schema in concordium-contracts-common. By improve, I mean that we could include a "stacktrace" to show where the incorrect value belongs. This is especially useful when the parameter is a struct or enum comprised of many fields.
So instead of giving the error Expected AccountAddress.
It should tell you this, but also include information about where it expects an account address. Similar to what concordium-client does:
Error: Could not decode parameters from file 'param.json' as JSON:
Expected value of type "<AccountAddress>", but got: 123.
In [
123
].
In enum variant '"Account"'.
In field 'operator'.
In {
"operator": {
"Account": [
123
]
},
"update": {
"Remove": []
}
}.
In [
{
"operator": {
"Account": [
123
]
},
"update": {
"Remove": []
}
}
].
Since the JavaScript SDKs recently started using concordium-contracts-common for handling the JSON to binary conversion, this issue has become more important.
Description
We could improve the error reporting when converting JSON parameters to binary using a schema in concordium-contracts-common. By improve, I mean that we could include a "stacktrace" to show where the incorrect value belongs. This is especially useful when the parameter is a struct or enum comprised of many fields.
So instead of giving the error
Expected AccountAddress
. It should tell you this, but also include information about where it expects an account address. Similar to what concordium-client does:Since the JavaScript SDKs recently started using concordium-contracts-common for handling the JSON to binary conversion, this issue has become more important.