-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f92d1c
commit 4680ec4
Showing
10 changed files
with
839 additions
and
599 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,5 @@ class ConversationState(Enum): | |
CPF, | ||
BACKLOG, | ||
ADD_BACKLOG_ENTRY, | ||
) = range(26) | ||
NOTIFICATION, | ||
) = range(27) |
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,28 @@ | ||
import logging | ||
|
||
|
||
logging.basicConfig(level=logging.ERROR, filename='telegram_bot.log', | ||
format='%(asctime)s - %(levelname)s - %(message)s') | ||
|
||
class BaseError(Exception): | ||
"""Base class for other exceptions""" | ||
def __init__(self, error_class, message="An error occurred", extra_info=""): | ||
self.message = message | ||
self.extra_info = extra_info | ||
self.error_class = error_class | ||
super().__init__(f"{self.error_class}: {self.message}") | ||
|
||
class GoogleSheetError(BaseError): | ||
"""Exception raised for errors in the Google Sheet service.""" | ||
def __init__(self, message="", extra_info=""): | ||
super().__init__("GoogleSheetError", message, extra_info) | ||
|
||
class TelegramBotError(BaseError): | ||
"""Exception raised for errors in the Telegram bot operations.""" | ||
def __init__(self, message="", extra_info=""): | ||
super().__init__("TelegramBotError", message, extra_info) | ||
|
||
class DatabaseError(BaseError): | ||
"""Exception raised for errors in database operations.""" | ||
def __init__(self, message="", extra_info=""): | ||
super().__init__("DatabaseError", message, extra_info) |
Oops, something went wrong.