diff options
author | Brad Warren <bmw@users.noreply.github.com> | 2017-09-01 02:35:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-01 02:35:53 +0300 |
commit | bbf397a9f96d480c4281eaaf40dc738cd77adb0d (patch) | |
tree | 227b2c04b1cb25f61118cb964ed1ebae6a3deefe | |
parent | 7cb8c1264f9eb7002243bda72e90db4467fd8876 (diff) |
Fix documentation build failures (#5068)
* sphinxify error_handler docs
-rw-r--r-- | certbot/error_handler.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/certbot/error_handler.py b/certbot/error_handler.py index b188b276a..842243f70 100644 --- a/certbot/error_handler.py +++ b/certbot/error_handler.py @@ -29,18 +29,19 @@ class ErrorHandler(object): """Context manager for running code that must be cleaned up on failure. The context manager allows you to register functions that will be called - when an exception (excluding SystemExit) or signal is encountered. Usage: + when an exception (excluding SystemExit) or signal is encountered. + Usage:: - handler = ErrorHandler(cleanup1_func, *cleanup1_args, **cleanup1_kwargs) - handler.register(cleanup2_func, *cleanup2_args, **cleanup2_kwargs) + handler = ErrorHandler(cleanup1_func, *cleanup1_args, **cleanup1_kwargs) + handler.register(cleanup2_func, *cleanup2_args, **cleanup2_kwargs) - with handler: - do_something() + with handler: + do_something() - Or for one cleanup function: + Or for one cleanup function:: - with ErrorHandler(func, args, kwargs): - do_something() + with ErrorHandler(func, args, kwargs): + do_something() If an exception is raised out of do_something, the cleanup functions will be called in last in first out order. Then the exception is raised. @@ -84,7 +85,7 @@ class ErrorHandler(object): return retval def register(self, func, *args, **kwargs): - """Sets func to be called with *args and **kwargs during cleanup + """Sets func to be run with the given arguments during cleanup. :param function func: function to be called in case of an error |