mirror of
https://github.com/Tech-Workers-Coalition-Italia/mobilizon-reshare.git
synced 2025-02-18 12:40:44 +01:00
* Fixed typo * Added proper exceptions for publishers * Updated publishers logics: using messengers to allow publications without events * Added new exception 'InvalidSettings' * Updated notifiers and publishers: retrieve credentials and destination from config, use only message/event in constructors, lesser refactoring * Updated publishers' tests * Updated notifiers and publishers config for Telegram service, updated settings.toml file * Updated 'post()' method and removed useless config checks for Telegram bot * Added jinja2 template management for message formatting methods * Manage message validation in publishers' run() method * Better config management for notifiers and publishers * Lesser update to logging and error-raising management (#23)
35 lines
870 B
Python
35 lines
870 B
Python
class PublisherError(Exception):
|
|
""" Generic publisher error """
|
|
|
|
def __init__(self, message):
|
|
""" :param str message: exception message """
|
|
super().__init__(message)
|
|
|
|
|
|
class InvalidAttribute(PublisherError):
|
|
""" Publisher defined with invalid or missing attribute """
|
|
|
|
|
|
class InvalidBot(PublisherError):
|
|
""" Publisher refers to the wrong service bot """
|
|
|
|
|
|
class InvalidCredentials(PublisherError):
|
|
""" Publisher cannot validate credentials """
|
|
|
|
|
|
class InvalidEvent(PublisherError):
|
|
""" Publisher cannot validate events """
|
|
|
|
|
|
class InvalidMessage(PublisherError):
|
|
""" Publisher cannot validate message """
|
|
|
|
|
|
class InvalidResponse(PublisherError):
|
|
""" Publisher receives an invalid response from its service """
|
|
|
|
|
|
class InvalidSettings(PublisherError):
|
|
""" Publisher settings are either missing or badly configured """
|