python-zulip-api/zulip_bots/zulip_bots/custom_exceptions.py
Robert Hönig 192e9e101d bots: Add magic method validate_config().
This method allows bots to validate their config info
in a standardized way. Adding the method to a bot is
optional, but recommended for bots with config options
that can be invalid, like api keys. The giphy bot serves
as an example.
The primary reason behind this is to allow the zulip
backend to validate config data for embedded bots. The
backend does not have a permanent bot class instance, so
validate_config() must be a static method.
2018-02-13 11:02:17 -08:00

12 lines
399 B
Python

# This file implements some custom exceptions that can
# be used by all bots.
# We avoid adding these exceptions to lib.py, because the
# current architecture works by lib.py importing bots, not
# the other way around.
class ConfigValidationError(Exception):
'''
Raise if the config data passed to a bot's validate_config()
is invalid (e.g. wrong API key, invalid email, etc.).
'''