Standardize error handling for Subversion.

Review Request #13226 — Created Aug. 20, 2023 and submitted

Information

Review Board
release-6.x

Reviewers

Our Subversion support split the responsibility for error handling up
into SVNTool.normalize_error() and into individual backend functions.
The SVNTool version was even checking for backend-specific errors, a
holdover from when backends were first introduced.

In general, error handling for Subversion is iffy, as it depends on
backend internals. libsvn and PySVN may produce error strings that are
all wrapped by a single exception, which may be used for backend errors,
PySVN configuration errors, or repository errors. If operating inside a
callback, we also can't raise our own exceptions (which will come up and
be addressed in a future change).

This change redoes all our error and operation handling. Now, SVNTool
leaves all error handling up to the client backends. Backends are
expected to invoke operations within a with self.communicate(): block,
which will capture any errors and then hand them to the backend to turn
into proper exceptions. This will also give us an avenue to raise our
own exceptions within callbacks later, for SSL.

PySVN backend communication code has been updated to work with
communicate(). _do_on_path() now better wraps this as a context
manager as well, simplifying various backend implementations and letting
us remove some private callback functions.

All unit tests pass.

Summary ID
Standardize error handling for Subversion.
Our Subversion support split the responsibility for error handling up into `SVNTool.normalize_error()` and into individual backend functions. The `SVNTool` version was even checking for backend-specific errors, a holdover from when backends were first introduced. In general, error handling for Subversion is iffy, as it depends on backend internals. libsvn and PySVN may produce error strings that are all wrapped by a single exception, which may be used for backend errors, PySVN configuration errors, or repository errors. If operating inside a callback, we also can't raise our own exceptions (which will come up and be addressed in a future change). This change redoes all our error and operation handling. Now, `SVNTool` leaves all error handling up to the client backends. Backends are expected to invoke operations within a `with self.communicate():` block, which will capture any errors and then hand them to the backend to turn into proper exceptions. This will also give us an avenue to raise our own exceptions within callbacks later, for SSL. PySVN backend communication code has been updated to work with `communicate()`. `_do_on_path()` now better wraps this as a context manager as well, simplifying various backend implementations and letting us remove some private callback functions.
53c56c7d4dee4380cbfe170d7085f032f45bdaaf
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-6.x (e85e58b)
Loading...