Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Decimo’s structured error type so that DecimoError always includes a message and function, ensuring tracebacks consistently show both fields (alongside auto-captured file/line).
Changes:
- Make
DecimoError.messageandDecimoError.functionmandatory (non-optional) and require them in__init__. - Update error construction call sites across parsing, numeric parsing, and numeric types to pass
message+function. - Convert a couple of previously string-raised errors to structured
ValueErrorinstances to comply with the new contract.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/decimo/errors.mojo | Makes message and function required fields/args and updates formatting accordingly. |
| src/decimo/toml/parser.mojo | Uses structured ValueError(message, function) for an inline-table duplicate-key error. |
| src/decimo/str.mojo | Adds function="parse_numeric_string()" to all ValueError construction sites in numeric string parsing. |
| src/decimo/decimal128/exponential.mojo | Adds required message to DecimoError wrappers in power(). |
| src/decimo/decimal128/decimal128.mojo | Uses structured ValueError(message, function) for from_components scale validation and adds function to other ValueErrors. |
| src/decimo/biguint/biguint.mojo | Adds required message to DecimoError wrappers. |
| src/decimo/biguint/arithmetics.mojo | Adds required message to DecimoError wrappers. |
| src/decimo/bigint10/bigint10.mojo | Adds required message to DecimoError wrappers. |
| src/decimo/bigint10/arithmetics.mojo | Adds required message to DecimoError wrappers. |
| src/decimo/bigint/bigint.mojo | Adds required message to DecimoError wrappers. |
| src/decimo/bigfloat/bigfloat.mojo | Adds required function / message to DecimoError sites (MPFR availability/allocation failures). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates Decimo’s structured error type so that
DecimoErroralways includes amessageandfunction, ensuring tracebacks consistently show both fields (alongside auto-captured file/line).Changes:
DecimoError.messageandDecimoError.functionmandatory (non-optional) and require them in__init__.message+function.ValueErrorinstances to comply with the new contract.