Prevent hangs on internal errors by rhendric · Pull Request #4126 · purescript/purescript · GitHub
Skip to content

Prevent hangs on internal errors - #4126

Merged
rhendric merged 1 commit into
purescript:masterfrom
rhendric:rhendric/fix-internal-error-hangs
Nov 12, 2021
Merged

rhendric merged 1 commit into
purescript:masterfrom
rhendric:rhendric/fix-internal-error-hangs

Conversation

@rhendric

@rhendric rhendric commented Jun 28, 2021 •

Copy link
Copy Markdown
Member

Description of the change

Sometimes, when one of our unit tests results in an internal error, the entire test process hangs. This is mildly annoying, and I think this PR is the appropriate fix? I have to confess that I don't have as solid an understanding of how MonadBaseControl works as I'd like. Also, our whole internal error story is kind of confusing to me—we have internalError, but also internalCompilerError, and a few instances of error scattered about to boot. I don't know if further enabling using the exception-based error functions instead of encouraging more use of the monadic internalCompilerError is the right thing to do.

Buuuuuut... this fix is quick and not too disruptive to the status quo, so I'm proposing it!


Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
  • Added myself to CONTRIBUTORS.md (if this is my first contribution)
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

@rhendric
rhendric force-pushed the rhendric/fix-internal-error-hangs branch from 6c0e5f0 to 69ac52c Compare June 28, 2021 20:26
@JordanMartinez JordanMartinez mentioned this pull request Jul 2, 2021
4 of 5 tasks
@rhendric
rhendric force-pushed the rhendric/fix-internal-error-hangs branch from 69ac52c to 6e56f51 Compare July 12, 2021 21:46
@hdgarrood

Copy link
Copy Markdown
Contributor

@hdgarrood

Copy link
Copy Markdown
Contributor

The code looks reasonable but I'm a little bit hesitant to approve, just because of where this change is. Does this change only appear to affect the unit tests, or does it affect running the compiler normally as well?

@natefaubion

Copy link
Copy Markdown
Contributor

I see internalCompilerError was introduced as part of polykinds so maybe @natefaubion can point out if I've missed something that makes using the monadic context more appealing.

The error will get tagged with the source position of the thing it was checking when the internal error occured. This is incredibly useful.

@hdgarrood

Copy link
Copy Markdown
Contributor

Ok, that is very convincing. So maybe the approach should be “use internalCompilerError if you’re working in a context where it works, and internalError otherwise? Maybe we could rename them and/or add comments to make this a bit clearer.

@rhendric

Copy link
Copy Markdown
Member Author

@hdgarrood hdgarrood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then, that also sounds like an improvement.

@rhendric
rhendric merged commit 7d286f8 into purescript:master Nov 12, 2021
@rhendric
rhendric deleted the rhendric/fix-internal-error-hangs branch November 12, 2021 21:24
@rhendric rhendric mentioned this pull request Mar 6, 2022
3 tasks done
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.

4 participants