-
Notifications
You must be signed in to change notification settings - Fork 23
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
Proposal to move types and errors files to dedicated folders #145
base: main
Are you sure you want to change the base?
Conversation
|
||
## Proposed Solution | ||
|
||
The proposed solution is to move these error and types files to dedicated folders e.g `L1/errors/`, `L1/types/`, `L2/errors/`, `L2/types/` etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the principle here. There's a reason we wanted error strings to be prefixed with the contract name, and I find generic Unauthorized
errors less helpful unless you're printing the trace (which requires more careful re
That said, I do like the idea of consolidating errors into a few locations, so what we could do is:
error Unauthorized(string location);
// and called as:
revert Unauthorized(type(SomeContract).name);
// this would be nice too, but for some reason is failing for me in `chisel`:
revert Unauthorized(type(this).name);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, can you bring this up on #143?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For how many errors do you think we could actually consolidate like that? I do like this syntax but if its just like 3 errors or so I think it might be fine to duplicate, but will continue discussion on #143
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally agree here. If it's just a few errors then I don't think it's worth it. Having a single unified standard is valuable.
Here's a recap and conclusion of the discussion between @smartcontracts, @ControlCplusControlV and I on discord
|
Discussed in #150. Conclusion was
|
This design doc proposes moving types and errors files out of
*/libraries/
and*/lib/
files and into dedicated folders named*/types/
and*/errors/
.Issues: