mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(exceptions): add InvariantError
This exception is to be used when a known invariant is violated. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
85e6ad03db
commit
bad57ba502
2 changed files with 11 additions and 0 deletions
|
@ -86,3 +86,7 @@ class ValidationError(AurwebException):
|
||||||
def __init__(self, data: Any, *args, **kwargs):
|
def __init__(self, data: Any, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
|
|
||||||
|
class InvariantError(AurwebException):
|
||||||
|
pass
|
||||||
|
|
|
@ -97,3 +97,10 @@ def test_repository_name_exception():
|
||||||
raise exceptions.InvalidRepositoryNameException("test")
|
raise exceptions.InvalidRepositoryNameException("test")
|
||||||
except exceptions.InvalidRepositoryNameException as exc:
|
except exceptions.InvalidRepositoryNameException as exc:
|
||||||
assert str(exc) == "invalid repository name: test"
|
assert str(exc) == "invalid repository name: test"
|
||||||
|
|
||||||
|
|
||||||
|
def test_invariant_error():
|
||||||
|
try:
|
||||||
|
raise exceptions.InvariantError("test")
|
||||||
|
except exceptions.InvariantError as exc:
|
||||||
|
assert str(exc) == "test"
|
||||||
|
|
Loading…
Add table
Reference in a new issue