-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create library specific errors with a generic exception class
- Loading branch information
Showing
4 changed files
with
35 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class SpotifyError(Exception): | ||
""" | ||
Generic base class for exceptions. | ||
""" | ||
def __init__(self, message): | ||
self.message = message | ||
|
||
def __str__(self): | ||
class_name = self.__class__.__name__ | ||
return f"{class_name}: {self.message}" | ||
|
||
class LimitOutOfRangeError(SpotifyError): | ||
def __init__(self, message): | ||
super().__init__(message) | ||
|
||
class InvalidTrackIdError(SpotifyError): | ||
def __init__(self, message): | ||
super().__init__(message) | ||
|