errors: Add a __repr__.
This makes the errors easier to understand in test failures.
This commit is contained in:
parent
34090df23f
commit
910b95c942
1 changed files with 7 additions and 0 deletions
|
@ -20,6 +20,13 @@ class _BaseError(Exception):
|
||||||
self.entry = entry
|
self.entry = entry
|
||||||
self.source = entry.meta if source is None else source
|
self.source = entry.meta if source is None else source
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{clsname}<{source[filename]}:{source[lineno]}: {message}>".format(
|
||||||
|
clsname=type(self).__name__,
|
||||||
|
message=self.message,
|
||||||
|
source=self.source,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class InvalidMetadataError(_BaseError):
|
class InvalidMetadataError(_BaseError):
|
||||||
def __init__(self, txn, post, key, value=None, source=None):
|
def __init__(self, txn, post, key, value=None, source=None):
|
||||||
|
|
Loading…
Reference in a new issue