Skip to content

Commit

Permalink
fix(completion): better handle native errors in completion funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno committed Feb 1, 2025
1 parent ee71122 commit 42e53cc
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 42e53cc

Please sign in to comment.