Skip to content

commit: Gracefully handle invalid arguments in RawBlame

Patrick Steinhardt requested to merge pks-raw-blame-fix-error-handling into master

In 76dfdf81 (commit: Refactor RawBlame to write into streamio writer diretcly, 2023-08-28), we have refactored the RawBlame RPC to handle writes more efficiently. Part of that refactoring was a change that causes us to return errors returned by git-blame(1), which have been completely ignored previously. And as one may expect, this has indeed caused us to detect new errors that we didn't previously know of:

- The RPC is sometimes invoked with a nonexistent path.

- The RPC is often invoked with an out-of-range blame range that
  exceeds the number of lines in the blamed file.

Both of these conditions currently cause us to return an Internal error, even though they are expected failure modes of this RPC.

Let's double down on the changed behaviour by detecting these failure cases and returning structured errors for both, which lets our callers handle these cases explicitly. Any other errors returned by git-blame(1) will continue to be returned as internal errors, which should help us to surface additional error conditions.

Closes RawBlame returns internal errors with invalid a... (#5594 - closed).

Merge request reports