mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:32:13 +02:00
Fix documentation build failures (#5068)
* sphinxify error_handler docs
This commit is contained in:
@@ -29,7 +29,8 @@ class ErrorHandler(object):
|
|||||||
"""Context manager for running code that must be cleaned up on failure.
|
"""Context manager for running code that must be cleaned up on failure.
|
||||||
|
|
||||||
The context manager allows you to register functions that will be called
|
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 = ErrorHandler(cleanup1_func, *cleanup1_args, **cleanup1_kwargs)
|
||||||
handler.register(cleanup2_func, *cleanup2_args, **cleanup2_kwargs)
|
handler.register(cleanup2_func, *cleanup2_args, **cleanup2_kwargs)
|
||||||
@@ -37,7 +38,7 @@ class ErrorHandler(object):
|
|||||||
with handler:
|
with handler:
|
||||||
do_something()
|
do_something()
|
||||||
|
|
||||||
Or for one cleanup function:
|
Or for one cleanup function::
|
||||||
|
|
||||||
with ErrorHandler(func, args, kwargs):
|
with ErrorHandler(func, args, kwargs):
|
||||||
do_something()
|
do_something()
|
||||||
@@ -84,7 +85,7 @@ class ErrorHandler(object):
|
|||||||
return retval
|
return retval
|
||||||
|
|
||||||
def register(self, func, *args, **kwargs):
|
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
|
:param function func: function to be called in case of an error
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user