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

fsIO - realPath: re-raise ENOENT javascript exceptions as NoSuchFileException #2759

Merged
merged 3 commits into from
Dec 19, 2021

Conversation

yurique
Copy link
Contributor

@yurique yurique commented Dec 19, 2021

calls to realPath in nodejs throw an ENOENT exception if the path doesn't exist. In order to align the behaviour of realPath with what we have in JVM, those errors are re-raised as a NoSuchFileException.

Comment on lines 324 to 327
F.fromPromise(F.delay(fsPromisesMod.realpath(path.toString))).map(Path(_)).recoverWith {
case NoSuchFileException(e) =>
F.raiseError(e)
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this is equivalent to:

.adaptError { case NoSuchFileException(ex) => ex }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha! Nice! I've completely forgotten about this one :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adapted it :)

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Thanks!

@armanbilge armanbilge merged commit 1a7dede into typelevel:main Dec 19, 2021
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.

2 participants