[docstring][error] Fixes raises: sections in docstrings across codebase to show correct error types#199
Conversation
…ror types are written
There was a problem hiding this comment.
Pull request overview
This PR updates docstring Raises: sections across Decimo to replace generic Error entries with specific error types (e.g., ValueError, OverflowError, ZeroDivisionError, ConversionError) so API documentation more accurately reflects runtime behavior.
Changes:
- Standardized and expanded docstring
Raises:sections across TOML parsing, numeric parsing, and multiple numeric types (Decimal128/Big*). - Replaced generic
Error/DecimoErrordocstring entries with concrete error types used by the implementation. - Added missing
Raises:sections to several functions that previously had none.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/decimo/toml/parser.mojo | Adds/clarifies Raises: ValueError in parser helpers and header/key parsing routines. |
| src/decimo/tests.mojo | Documents ValueError raised by TOML test helper parse_file(). |
| src/decimo/str.mojo | Documents ValueError for malformed numeric strings in parse_numeric_string(). |
| src/decimo/decimal128/special.mojo | Documents ValueError/OverflowError for factorial helpers. |
| src/decimo/decimal128/rounding.mojo | Documents OverflowError for rounding overflow cases. |
| src/decimo/decimal128/exponential.mojo | Rewrites Raises: for power/root/log/exp functions to specific error types. |
| src/decimo/decimal128/decimal128.mojo | Updates constructor/conversion docstrings to reflect ConversionError, ValueError, OverflowError. |
| src/decimo/decimal128/constants.mojo | Documents ValueError for invalid constant selector inputs. |
| src/decimo/decimal128/arithmetics.mojo | Documents OverflowError/ZeroDivisionError for arithmetic operations. |
| src/decimo/biguint/biguint.mojo | Updates conversion/operator docstrings to specific overflow/conversion error types. |
| src/decimo/biguint/arithmetics.mojo | Documents ZeroDivisionError/OverflowError/ValueError in arithmetic helpers. |
| src/decimo/bigint10/bigint10.mojo | Adds/updates Raises: for parsing/conversion and arithmetic wrapper methods. |
| src/decimo/bigint10/arithmetics.mojo | Documents ZeroDivisionError for division/modulo operations. |
| src/decimo/bigint/number_theory.mojo | Documents ValueError for invalid modular arithmetic inputs. |
| src/decimo/bigint/exponential.mojo | Documents ValueError for invalid sqrt/isqrt inputs. |
| src/decimo/bigint/bigint.mojo | Updates string/overflow/division/power docstrings with more specific error types. |
| src/decimo/bigint/arithmetics.mojo | Documents ZeroDivisionError and ValueError in division/power helpers. |
| src/decimo/bigfloat/bigfloat.mojo | Documents RuntimeError/ConversionError for MPFR-backed operations. |
| src/decimo/bigdecimal/trigonometric.mojo | Documents ValueError for undefined trig reciprocal cases. |
| src/decimo/bigdecimal/exponential.mojo | Updates power/root/log/exp docstrings with specific error types. |
| src/decimo/bigdecimal/constants.mojo | Documents ValueError on invalid precision for constants. |
| src/decimo/bigdecimal/bigdecimal.mojo | Documents conversion-related ValueError/ConversionError cases. |
| src/decimo/bigdecimal/arithmetics.mojo | Documents ZeroDivisionError for division/modulo functions. |
💡 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 docstring
Raises:sections across Decimo to replace genericErrorentries with specific error types (e.g.,ValueError,OverflowError,ZeroDivisionError,ConversionError) so API documentation more accurately reflects runtime behavior.Changes:
Raises:sections across TOML parsing, numeric parsing, and multiple numeric types (Decimal128/Big*).Error/DecimoErrordocstring entries with concrete error types used by the implementation.Raises:sections to several functions that previously had none.