Open arboleya opened 10 months ago
One approach to do this is would be to make each coder aware of the abi it's encoding/decoding so that they can throw an abi-specific message like: encode-error: invalid u8 for property "a.b.c.d: passed in value is 24242, max is 255"
or, to be fancier:
encode-error: invalid u8 while encoding abi:
{
a: {
a1: 54,
b: {
b1: "text",
b2: "0xasdfwer",
c: {
c1: [1,2,3],
-----> d: Encoding 6464, max for u8 is 255.
}
}
}
}
It would definitely be nice to have one of the above, but is it worthwhile to implement? On first hunch it feels like it would require a lot of custom code.
I don't see another way to substantially improve the error messages besides this.
@FuelLabs/sdk-ts What do you think?
@arboleya It might be wise to block this until the new encoding scheme is finished.
Blocked by:
@nedsalk @Dhaiwat10 Do you guys think this is still blocked, now that we merged https://github.com/FuelLabs/fuels-ts/pull/1826?
cc @petertonysmith94
@arboleya I believe it's blocked by the new encoding #1672, rather than #1826.
In light of #1826, the problem will be on Predicate
instantiation - rather than the setData
method (which has been removed).
Maybe @Dhaiwat10 could confirm my understanding 🙏🏼
I wonder if these errors weren't revert errors, in which case could be related to https://github.com/FuelLabs/fuels-ts/pull/1840.
I believe this issue is in reference to the Coder
based errors in general. They're super generic (in description) and I don't believe there is any feedback to where or how these errors have been thrown (I could be wrong).
Take for instance the ArrayCoder
, wouldn't the index of the Array be useful.
Also the aggregate coders, take TransactionScriptCoder
for instance, would be good to know the argument that failed - rather than Invalid u8.
when an error occurs for the witnessCount
.
This feedback came in response to the development of the WebAuthn, referenced in the issue description:
Changing topic from Library
to ABI
as it appears more related to encoding.
Better error messages for predicate setData | The current encoding error messages were weak on details and should be improved.
The current encoding error messages were weak on details and should be improved.