From 063f3b19289f353ec57f904f700fc5567a4584ba Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Fri, 29 Oct 2021 14:51:57 +0800 Subject: Define TenantIdentityError --- jimbrella/exceptions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jimbrella/exceptions.py b/jimbrella/exceptions.py index c0cc055..498c6c4 100644 --- a/jimbrella/exceptions.py +++ b/jimbrella/exceptions.py @@ -27,6 +27,16 @@ class UmbrellaValueError(Exception): super().__init__(self.message) +class TenantIdentityError(Exception): + """For when a tenant attempts to return an umbrella that's borrowed by another tenant.""" + + def __init__(self, expected, got): + self.expected = expected + self.got = got + self.message = f"Umbrella is borrowed by {expected} and {got} cannot return it." + super().__init__(self.message) + + class UsernameTakenError(Exception): """For when a username to be registered with is already taken.""" -- cgit v1.2.3