Closed alcuadrado closed 4 days ago
Latest commit: b142e0d3577dfd80e6a246b08f42ed3ebef70509
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
hardhat | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 29, 2024 11:01pm |
This PR introduces a
no-restricted-syntax
rule that forbids throwing any error except for:throw new HardhatError(...)
throw variableName
withincatch
clauses. — The rationale here is to allow re-throwing of the error that was caught.We could later improve this with a custom rule to:
HardhatError
throw variable
when the variable is the one in thecatch (variable)
.I believe that
no-restricted-syntax
isn't expressive enough for these things, as they are semantic conditions and not entirely syntactic. Still, I think this is a good trade-off.PS: This depends on #5460 just for convenience and to avoid merge conflicts.