Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

try-runtime proper error types #13736

Closed
kianenigma opened this issue Mar 28, 2023 · 2 comments · Fixed by #13993
Closed

try-runtime proper error types #13736

kianenigma opened this issue Mar 28, 2023 · 2 comments · Fixed by #13993
Assignees
Labels
J0-enhancement An additional feature request.

Comments

@kianenigma
Copy link
Contributor

The current try-runtime code paths are all using a very very rudimentary &'static str as the error type. Even worse, we don't really handle the error in many places because these strings are not all that useful.

Instead, the try-runtime APIs and machinery should either have its very own error type, or even better, use the very flexible DispatchError. All existing &'static str error can be easily converted to DispatchResult via .into().

This is slightly bad in terms of naming, as try-runtime code paths are not necessarily Dispatched, but we really want to reuse DispatchResult's ability to reference exactly which module it is coming from.

If someone works on this and realizes that it is not worthwhile, or if there is a technical issue along the way, we should remove the return type and simply standardize panics in try_state and family.

@kianenigma kianenigma added the J0-enhancement An additional feature request. label Mar 28, 2023
@Szegoo
Copy link
Contributor

Szegoo commented Mar 28, 2023

@kianenigma IIUC we should use DispatchError::Other since we don't want to add new variants to the existing enum, right?

@kianenigma
Copy link
Contributor Author

DispatchError::Other should be used with a &'static str in case no error enum variant from the module can be used .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants