Skip to content
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

Improved error handling #13

Closed
jon-axon opened this issue Feb 22, 2023 · 1 comment
Closed

Improved error handling #13

jon-axon opened this issue Feb 22, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@jon-axon
Copy link
Owner

jon-axon commented Feb 22, 2023

Error handling is currently handled fairly robustly from a pattern perspective, with the crate-specific Error enum used to differentiate multiple variants of internal error, and all Chipolata back-end functions bubbling-up any such errors to the hosting application. However at present the enum variants contain no data fields that hold details of the actual errors; all that's reported is the type of error e.g. "invalid operands" (but without saying what the operands are. This should be expanded:

  • Data pertinent to the specific error should be added to the enum
  • Surrounding context (e.g. CPU cycles) should also be added
@jon-axon jon-axon changed the title Error handling Improved error handling Feb 23, 2023
@jon-axon jon-axon self-assigned this Feb 23, 2023
@jon-axon jon-axon added the enhancement New feature or request label Feb 23, 2023
@jon-axon jon-axon added this to the v0.2 (CHIP-8 emulation) milestone Feb 25, 2023
@jon-axon
Copy link
Owner Author

This has now been addressed by:

  • Renaming the previous Error enum to ErrorDetail, and adding fields to many of the variants to allow details of the specific error to be captured
  • Adding a new ChipolataError struct, that holds a StateSnapshot representation of the processor at the point of error, plus an associated ErrorDetail instance
  • Public methods of Processor now return ChipolataError, while lower-level functions bubble-up ErrorDetail instead (captured within the ChipolataError before Processor passes this back to the hosting application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant