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

fix(completion): better handle native errors in completion funcs #373

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion brush-core/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,10 @@ impl Spec {
let _ = shell.env.unset(var_name);
}

let result = invoke_result?;
let result = invoke_result.unwrap_or_else(|e| {
tracing::warn!(target: trace_categories::COMPLETION, "error while running completion function '{function_name}': {e}");
1 // Report back a non-zero exit code.
});

// When the function returns the special value 124, then it's a request
// for us to restart the completion process.
Expand Down
Loading