From e4aedcce9774b105c44d47f1375e1603d62c38d6 Mon Sep 17 00:00:00 2001 From: sudosnok Date: Sun, 27 Mar 2022 12:11:01 +0100 Subject: [PATCH] Added a couple more exceptions --- Github/exceptions.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Github/exceptions.py b/Github/exceptions.py index 20381cb..541294b 100644 --- a/Github/exceptions.py +++ b/Github/exceptions.py @@ -11,7 +11,9 @@ __all__ = ( 'RepositoryNotFound', 'ObjectNotFound', 'NoAuthProvided', - 'InvalidAuthCombination' + 'InvalidAuthCombination', + 'AlreadyStarted', + 'NotStarted' ) class APIError(Exception): @@ -61,4 +63,16 @@ class NoAuthProvided(APIError): class InvalidAuthCombination(APIError): def __init__(self): msg = 'You must provide both a username and a user token or neither.' + super().__init__(msg) + +class AlreadyStarted(APIError): + """Raised when start is called multiple times.""" + def __init__(self): + msg = 'This client has already been started and cannot be started again.' + super().__init__(msg) + +class NotStarted(APIError): + """Raised when a call is made before start is called.""" + def __init__(self): + msg = 'You must call `await .start()` before making this call.' super().__init__(msg) \ No newline at end of file