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

Feature request: better error matching support #313

Closed
sander2 opened this issue Nov 9, 2021 · 1 comment
Closed

Feature request: better error matching support #313

sander2 opened this issue Nov 9, 2021 · 1 comment

Comments

@sander2
Copy link
Contributor

sander2 commented Nov 9, 2021

It would be really nice if we could pattern match on returned dispatch errors. E.g. something like

match error {
    SubxtRuntimeError::Module(MyModule::MyError) => {...}
    _ => ...,
}

Currently we have to manually check the PalletError.pallet and PalletError.error strings, and these string constants are not exposed in the generated code.

@jsdw
Copy link
Collaborator

jsdw commented Apr 6, 2023

I'll close this since a fix for this is proposed in #734 now :)

One won't be able to immediately pattern match, since the errors are generated via static codegen (which is optional), but an .as_root_error<runtime::Error>() will be provided to attempt to decode some ModuleError into a "pretty" static type.

@jsdw jsdw closed this as completed Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants