The Error class is what underlies the add_error() methods on MockSession and other Container classes.
Error instances are used to simulate error conditions in Subversion-facing programs.
The Error class is what underlies the add_error() methods on MockSession and other Container classes.
Error instances are used to simulate error conditions in Subversion-facing programs.
Error inherits from the SingleState and State base classes (in that order) and conforms to the protocols defined by both.
This page details only areas where Error extends or deviates from those protocols.
The Error() constructor takes three arguments, all of which are required.
Error(svn.fs.youngest_rev, (fs, apr_pool), MyError)
Error(svn.fs.youngest_rev, (fs, apr_pool), \
MyError('Oops!'))
The first parameter is the function object to be checked against.
It will be compared with the incoming API function call using is.
The second parameter is used to specify the arguments that the API function should be passed; any iterable may be used for this. In order to specify that the function should accept no arguments, pass an empty iterable, such as an empty tuple.
It is used to specify the exception that will be raised by the API function call. This may be either an exception class or an instance of an exception class.
Error.__call__ conforms to the SingleState protocol.
If the incoming API function call validates, Error.__call__ will raise the exception that was passed as the third parameter to the Error() constructor.
When an Error instance is called (Error.__call__) the next() method of the instance's container will be invoked regardless of whether or not the API call validated successfully or not.