File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
pydis_core/utils/error_handling/commands Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ from .abc import AbstractCommandErrorHandler
2+
3+ __all__ = ["AbstractCommandErrorHandler" ]
Original file line number Diff line number Diff line change 1+ from abc import ABC , abstractmethod
2+ from typing import NoReturn
3+
4+ from discord import Interaction
5+ from discord .ext .commands import Context
6+
7+
8+ class AbstractCommandErrorHandler (ABC ):
9+ """An abstract command error handler."""
10+
11+ @abstractmethod
12+ async def should_handle_error (self , error : Exception ) -> bool :
13+ """A predicate that determines whether the error should be handled."""
14+ raise NotImplementedError
15+
16+ @abstractmethod
17+ async def handle_app_command_error (self , interaction : Interaction , error : Exception ) -> NoReturn :
18+ """Handle error raised in the context of app commands."""
19+ raise NotImplementedError
20+
21+ @abstractmethod
22+ async def handle_text_command_error (self , context : Context , error : Exception ) -> NoReturn :
23+ """Handle error raised in the context of text commands."""
24+ raise NotImplementedError
You can’t perform that action at this time.
0 commit comments