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

[ refactor ] Improve error handling in Core #3434

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

spcfox
Copy link
Contributor

@spcfox spcfox commented Dec 3, 2024

Description

  • Added utility functions to handle errors in Core.
  • Added new error types: NonZeroExitCode, SystemError, CodegenNotFound, UnsupportedOpertaion.
  • Added error handling in many places where they were ignored.
  • All coreLift_ calls replaced by explicit result processing.
  • Removed Maybe from compileExpr and incCompileFile signatures. Instead of returning Nothing, throw is used. Earlier both variants were found in the code. Using throw allows you to pass a more clear error.
  • fix Successful exit code after error in --exec #3427: the --exec command returns the program exit code. If several --exec options are passed, the result of the last execution will be returned.
  • Removed CompilationFailed from REPLResult. More specific errors using throw are returned instead.

Should this change go in the CHANGELOG?

  • If this is a fix, user-facing change, a compiler change, or a new paper
    implementation, I have updated CHANGELOG_NEXT.md (and potentially also
    CONTRIBUTORS.md).

@spcfox spcfox marked this pull request as draft December 3, 2024 13:41
src/Compiler/ES/Node.idr Outdated Show resolved Hide resolved
src/Compiler/RefC/RefC.idr Outdated Show resolved Hide resolved
src/Compiler/Scheme/Gambit.idr Outdated Show resolved Hide resolved
src/Compiler/Scheme/Racket.idr Outdated Show resolved Hide resolved
src/Compiler/ES/Node.idr Outdated Show resolved Hide resolved
@spcfox spcfox marked this pull request as ready for review December 4, 2024 12:41
@spcfox
Copy link
Contributor Author

spcfox commented Dec 9, 2024

This PR is ready for review. The lsp build is failing because I deleted CompilationFailed. I have not yet made a PR fixing this because I allow for the possibility of revising this decision during review.

@spcfox spcfox requested a review from gallais December 9, 2024 15:28
@spcfox
Copy link
Contributor Author

spcfox commented Dec 9, 2024

If my refactoring is questionable, I can put everything related to #3427 in a separate PR to simplify the review

@spcfox spcfox force-pushed the cg-error-handle branch 3 times, most recently from 55392d1 to 3f15823 Compare December 19, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Successful exit code after error in --exec
3 participants