From 49a56a3cdb4ab41df6e1117864a94dff0246ee9d Mon Sep 17 00:00:00 2001 From: mkb79 Date: Tue, 22 Oct 2024 22:28:44 +0200 Subject: [PATCH] Refactor exception hierarchy under AudibleError. (#550) --- src/audible/exceptions.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/audible/exceptions.py b/src/audible/exceptions.py index 77ebebe8..67521a64 100644 --- a/src/audible/exceptions.py +++ b/src/audible/exceptions.py @@ -5,10 +5,14 @@ import httpx -class RequestError(Exception): +class AudibleError(Exception): """Base class for all errors.""" +class RequestError(AudibleError): + """Base class for all request errors.""" + + class StatusError(RequestError): """Base class for all errors except NotResponding and RatelimitDetectedError.""" @@ -72,13 +76,13 @@ class UnexpectedError(StatusError): """Raised if the error was not caught.""" -class AuthFlowError(Exception): +class AuthFlowError(AudibleError): """Raised if no auth method available.""" -class NoRefreshToken(Exception): +class NoRefreshToken(AudibleError): """Raised if refresh token is needed but not provided.""" -class FileEncryptionError(Exception): +class FileEncryptionError(AudibleError): """Raised if something is wrong with file encryption."""