-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
fix: returns rejected promise instead throw error when call provider methods #500
Conversation
WalkthroughThe update introduces a more asynchronous approach by utilizing promises to handle parent and children node retrieval in the Vim environment, enhancing efficiency and responsiveness. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- autoload/fern/internal/node.vim (2 hunks)
Additional comments not posted (1)
autoload/fern/internal/node.vim (1)
95-96
: Ensure proper error handling in the promise chain.
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- autoload/fern/internal/node.vim (2 hunks)
- autoload/fern/scheme/file/util.vim (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- autoload/fern/internal/node.vim
Additional comments not posted (1)
autoload/fern/scheme/file/util.vim (1)
40-40
: Change to uses:Promise.new
for better error handling approved.Verification successful
The verification process has confirmed that the usage of
s:Promise.new
in conjunction with.catch()
for error handling is implemented across the codebase, including inautoload/fern/scheme/file/util.vim
. This aligns with the initial review comment's approval of the change for better error handling. The promise correctly handles errors without breaking the chain, as evidenced by the explicit error handling patterns found.
autoload/fern/scheme/file/util.vim
: Errors are handled by rejecting the promise with an error message, ensuring that errors do not break the promise chain.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the promise correctly handles errors without breaking the chain. # Test: Search for error handling patterns in the usage of `s:Promise.new`. rg --type vim $'s:Promise.new'Length of output: 1232
Script:
#!/bin/bash # Description: Check for error handling mechanisms in the context of `s:Promise.new` usage. # Test: Search for patterns that handle promise rejections or errors in the entire codebase. rg --type vim $'catch\('Length of output: 1470
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- autoload/fern/internal/node.vim (2 hunks)
- autoload/fern/scheme/file/util.vim (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- autoload/fern/internal/node.vim
- autoload/fern/scheme/file/util.vim
@@ -37,7 +37,8 @@ if exists('*readdir') | |||
let l:Profile = fern#profile#start('fern#scheme#file#util#list_entries_readdir') | |||
let s = s:is_windows ? '\' : '/' | |||
let p = a:path[-1:] ==# s ? a:path : (a:path . s) | |||
return s:Promise.resolve(readdir(a:path)) | |||
silent! let children = readdir(a:path) |
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.
📝
readdir
returns an empty list on error.
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.
readdir
returns an empty list on error, AND generate an exception.
If it called in function with abort
, The function exits with an exception before the assignment.
Thanks! |
If the provider's method throws an error, the promise chain is broken and
Done
will not be called.Summary by CodeRabbit
list_entries_readdir
function inautoload/fern/scheme/file/util.vim
to usePromise.new
for resolving the readdir operation.