-
Notifications
You must be signed in to change notification settings - Fork 54
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
Rework error naming #671
Comments
I mentioned on Discord that it should be possible to extract the error constants and their associated error message automatically in a build.rs file from the kernel masm files. For a given masm file, we extract the comment before the constants definition as the error message, e.g.
would turn into pub const ERR_FAUCET_BURN_OVER_ISSUANCE: u32 = 0x00020023; and pub const KERNEL_ERRORS: [(u32, &str); _] = [
(ERR_FAUCET_BURN_OVER_ISSUANCE, "Asset burn can not exceed the existing supply"),
]; so the same as now, just automatically. The reworked error names from #712 could still be used, but using the error message from the comment allows for a better error, since one can elaborate more in an error message than in a constant's name, one can give better context and generally make the error read more like a natural sentence. With error messages we can give context from where the error originated like "transaction prologue: new account vault must be empty" whereas in the constant AlternativeThe error names are already much better and quite self-sufficient with #712, so if the above is somehow not possible or desirable then I would propose to still use a build.rs script and extract only the constants, and rewrite the constant names to nicer strings, e.g. Also I'm happy to work on this 🙂 |
I like this! Let's do this and then this will supersede #712. I'll assign this issue to you. |
@PhilippGackstatter Awesome idea! This approach will make the error maintenance a lot more easy. |
Thanks for the hint! I'll build on top of your work then 👍 |
Superseded by the work done in #906. |
What should be done?
Change the names of the errors so that the essence of the error is clear only by name.
Change grouping of the errors so that their finding will be easier and faster.
How should it be done?
The names of the constants representing the error codes should be changed both in the
.rs
and.masm
files.Error codes constants in the
miden-tx/src/error.rs
file should be divided into groups.When is this task done?
The task is done when error constants have the proper easy to understand names listed by groups.
Additional context
Original comment: #634 (review)
The text was updated successfully, but these errors were encountered: