-
Notifications
You must be signed in to change notification settings - Fork 629
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
BREAKING(fs): throw Deno.errors.NotFound
instead of WalkError
in walk[Sync]()
#5477
Conversation
…d` in `walk[Sync]()`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5477 +/- ##
==========================================
+ Coverage 96.39% 96.40% +0.01%
==========================================
Files 465 465
Lines 37757 37727 -30
Branches 5579 5574 -5
==========================================
- Hits 36397 36372 -25
+ Misses 1318 1313 -5
Partials 42 42 ☔ View full report in Codecov by Sentry. |
WalkError
exception with Deno.errors.NotFound
in walk[Sync]()
Deno.errors.NotFound
instead of WalkError
in walk[Sync]()
Deno.errors.NotFound
instead of WalkError
in walk[Sync]()
WalkError
in walk[Sync]()
|
That suggestion was made as a passing remark rather than being triggered from a reported need from a user. After recent work on errors in the codebase, I'm becoming more convinced that throwing naturally is sufficient in almost all cases. If it's good enough for the runtime, I think it's good enough for the Standard Library. |
Furthermore, |
Also the user needs to parse the path from the error message of Deno.errors.NotFound to get the path. The feels like degraded DX. |
@lowlighter and @lambdalisue are the users of WalkError in open source https://github.com/search?q=WalkError+std%2Ffs&type=code What do you think about this change? |
Also I think @binyamin uses this in some projects #3023 (comment) @binyamin Do you still use |
If the change is clearly mentioned in the release notes, I'm fine with it. In fact, I prefer |
+1 on going with |
WalkError
in walk[Sync]()
Deno.errors.NotFound
instead of WalkError
in walk[Sync]()
I concur with what have been already said |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedbacks/comments!
LGTM
What's changed
walk()
andwalkSync()
now naturally throwDeno.errors.NotFound
instead of throwingWalkError
. Theroot
property has also been removed and themessage
property no longer includes the normalized path.Motivation
This change was made to allow these functions to delegate error throwing functionality to the Deno runtime, which provides sufficient context naturally. This also removes a dependency on
@std/path/normalize
and slightly reduces the API surface area of@std/fs/walk
.Migration guide
To migrate, compare against
Deno.errors.NotFound
instead ofWalkError
when error-handlingwalk()
.Related
Towards #5476