Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Prevent hie crash if apply-refact crashes #1220

Merged
merged 4 commits into from
May 1, 2019

Conversation

Hogeyama
Copy link
Contributor

Fixes #451

Note: We need to catch SomeException because applyRefactorings throw an error by error.

Catch all SomeExceptions that apply-refact might throw
@fendor
Copy link
Collaborator

fendor commented Apr 30, 2019

We never catch SomeException, because of async exceptions.
If the error has been issued by error you can catch ErrorCall

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

You can use catches :: IO a -> [Handler a] -> IO a and catch both IOException and ErrorCall

EDIT: catches looks like it has a wrong type, however, I hope the idea is clear.
Maybe catchJust or tryJust fit better?

@Hogeyama
Copy link
Contributor Author

Oh, I missed the edit. I'll rewrite it by using tryJust

@fendor
Copy link
Collaborator

fendor commented Apr 30, 2019

If it works, I wouldn't change it. I thought, it may not do what we expected.

However, do you have some kind of tests to validate that this really fixes the problem? Would be great to have a test or two for regression testing!

@fendor
Copy link
Collaborator

fendor commented Apr 30, 2019

Looks great now!

@Hogeyama
Copy link
Contributor Author

Thank you!

@alanz alanz merged commit ac38be3 into haskell:master May 1, 2019
@alanz alanz added this to the 2019-04 milestone May 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HIE stops working in VS Code when apply-refact fails
3 participants