Module graia.broadcast.builtin.event

Expand source code
from typing import TYPE_CHECKING
from ..entities.dispatcher import BaseDispatcher
from ..entities.event import BaseEvent

if TYPE_CHECKING:
    from graia.broadcast.interfaces.dispatcher import DispatcherInterface


class ExceptionThrowed(BaseEvent):
    exception: Exception
    event: BaseEvent

    class Dispatcher(BaseDispatcher):
        @staticmethod
        def catch(interface: "DispatcherInterface"):
            if interface.annotation == interface.event.exception.__class__:
                return interface.event.exception
            if interface.name == "event":
                return interface.event.event

Classes

class ExceptionThrowed (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ExceptionThrowed(BaseEvent):
    exception: Exception
    event: BaseEvent

    class Dispatcher(BaseDispatcher):
        @staticmethod
        def catch(interface: "DispatcherInterface"):
            if interface.annotation == interface.event.exception.__class__:
                return interface.event.exception
            if interface.name == "event":
                return interface.event.event

Ancestors

  • BaseEvent
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Dispatcher

所有非单函数型 Dispatcher 的基类, 用于为参数解析提供可扩展的支持.

var eventBaseEvent
var exception : Exception