diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-29 04:29:29 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-29 04:29:29 +0000 |
commit | 03daa91d1c9c355f5f964095371c81d73fb9e08a (patch) | |
tree | 27af14d486bd67d828c8877c0e48a5c1ec2103c9 /ipalib/errors.py | |
parent | 8dc0e263dac8bf4074e48fcca593a00cadec03e0 (diff) | |
download | freeipa-03daa91d1c9c355f5f964095371c81d73fb9e08a.tar.gz freeipa-03daa91d1c9c355f5f964095371c81d73fb9e08a.tar.xz freeipa-03daa91d1c9c355f5f964095371c81d73fb9e08a.zip |
222: Fixed broken assertion in IPATypeError; did more work on docstrings in same
Diffstat (limited to 'ipalib/errors.py')
-rw-r--r-- | ipalib/errors.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ipalib/errors.py b/ipalib/errors.py index 70128f7ca..522253738 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -24,18 +24,22 @@ All custom errors raised by `ipalib` package. class IPATypeError(TypeError): """ - TypeError subclass with standard message for easier debugging. + A TypeError subclass with with a standard message. Also has two custom attributes: ``type`` - The type being tested against. ``value`` - The offending value that caused the exception. + + There is no edict that all TypeError should be raised with IPATypeError, + but when it fits, use it... it makes the unit tests faster to write and + the debugging easier to read. """ format = 'need a %r; got %r' def __init__(self, type_, value): - assert type(value) is not type, 'no error: %r, %r' % (type_, value) + assert type(value) is not type_, '%r is a %r' % (value, type_) self.type = type_ self.value = value TypeError.__init__(self, self.format % (self.type, self.value)) |