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

Introduce general BadOrigin runtime error #4409

Closed
gavofyork opened this issue Dec 17, 2019 · 2 comments · Fixed by #4449
Closed

Introduce general BadOrigin runtime error #4409

gavofyork opened this issue Dec 17, 2019 · 2 comments · Fixed by #4449
Assignees
Labels
I7-refactor Code needs refactoring.
Milestone

Comments

@gavofyork
Copy link
Member

Right now module use various ways for reporting bad origins, even though the origin recognition APIs are all reusable library code. Some report a &str (of various content), others report a local BadOrigin-like error type.

Instead, there should be a single BadOrigin error (e.g. defined in frame_system) that all ensure_origin/try_origin/ensure_root/ensure_nobody/ensure_signed functions and their ilk use. If modules want to customise the error to something local, then they can with map_err, but a simple ensure_root(origin)? should Just Work.

@gavofyork gavofyork added the I7-refactor Code needs refactoring. label Dec 17, 2019
@gavofyork gavofyork added this to the 2.1 milestone Dec 17, 2019
@gavofyork
Copy link
Member Author

@DarkEld3r maybe one for you?

@shawntabrizi
Copy link
Member

Related: #4365

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I7-refactor Code needs refactoring.
Projects
None yet
4 participants