Display error from shell command in popup box same as success #10947
+32
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The changes below are to make a popup box appear when the shell has an error in the same manner as a successful run.
Talked about in #7509
The status bar appears to have been improved since the issue was raised I have not seen "async job failed"
Testing
My test example was just typing from normal mode
Changes
I add a new callback type that returns an anyhow result
Changed the shell callback inner function to use the new callback type when shell output fails.
Alternative approach
My preferred approach is to modify EditorCompositorCallback to return a anyhow result with the rest of the code just returning the ok result.
That approach requires more work so I want to get feedback before I commit to it
Challenges
When callback defined in run_shell_command function returns an error result, it matches the error branch on add which doesn't have access to the editor or Compositor.