exceptions module

Note

This module is imports as from .. import exceptions. This means that you must use ezbotf.exceptions.PluginError as example.

All exceptions from the framework

PluginError

class ezbotf.exceptions.PluginError(plugin_name: str, description: str, *args)

Class for all the plugins errors. If you want to create own error, it must inherit

Variables:
  • plugin_name – Name of the plugin raised exception

  • description – Description of the exception

__init__(plugin_name: str, description: str, *args)
Parameters:
  • plugin_name – Name of the plugin that raises the exception

  • description – Description of the error

Example for plugin:

import ezbotf

plugin = ezbotf.Plugin(ezbotf.PluginType.Standalone)


class SpecialFailError(ezbotf.exceptions.PluginError):

    def __init__(self):
        super().__init__('specially failed for the example')
        # NOTE: This will be interpreted as:
        # >>> MyPlugin.SpecialFailError: Plugin "FailPlugin" specially failed for the example

@plugin.on_load
def on_load():

    @plugin.command('forcefail')
    async def forcefail(event, args):
        raise SpecialFailError()  # Raise our error

        # You can also use:
        # raise ezbotf.exceptions.PluginError('specially failed for the example')

IncorrectInstanceConfigError

class ezbotf.exceptions.IncorrectInstanceConfigError(config_path: str, *args)

Errors if the config of instance is incorrect

Variables:

config_path – path to the config

__init__(config_path: str, *args)
Parameters:

config_path – path to the config

Note

This exception is only used if config given to instance is incorrect