Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More informative error when failing to decode type #1599

Open
mrcnski opened this issue Dec 18, 2023 · 2 comments
Open

More informative error when failing to decode type #1599

mrcnski opened this issue Dec 18, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mrcnski
Copy link
Contributor

mrcnski commented Dec 18, 2023

Is your feature request related to a problem? Please describe.

It's possible to get an error like this:

         Error:  
                 createType(Header):: decodeU8aStruct: failed at 0xf10d89ba1e7bce… on extrinsicsRoot (index 4/5): H256:: Expected input with 32 bytes (256 bits), found 7 bytes

The fix is to add these lines, but it's not obvious:

[types.Header]
number = "u64"
parent_hash = "Hash"
post_state = "Hash"

Describe the solution you'd like

The error message could suggest how to fix the error, with a link to [Types] doc (and we can add an example to that doc).

Describe alternatives you've considered

No response

Additional context

No response

@pepoviola
Copy link
Collaborator

Hi @mrcnski, thanks for your feedback! The main issue there is that the error is generated by polkadot.js itself. We can catch and match the message for producing a better output. I will try to explore this path and ping you back for testing.

Thanks!!

@pepoviola pepoviola added enhancement New feature or request good first issue Good for newcomers labels Dec 24, 2023
@mrcnski
Copy link
Contributor Author

mrcnski commented Dec 26, 2023

Would it be worthwhile to analyze polkadot.js and see why it seems to work fine and display information correctly for the same network? Does it use polkadot.js or something different? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants