Passed
Pull Request — main (#114)
by
unknown
01:30
created

error_handler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 14
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A ErrorHandler.on_command_error() 0 10 1
1
from pincer import Client
2
from pincer.objects import MessageContext, Embed
3
4
5
class ErrorHandler:
6
    @Client.event
7
    async def on_command_error(self, ctx: MessageContext, error: Exception):
8
        return Embed(
9
            "Oops...",
10
            "An error occurred while trying to execute the "
11
            f"`{ctx.command.app.name}` command! Please retry later!",
12
            color=0xff0000
13
        ).add_field(
14
            "Exception:",
15
            f"```\n{type(error).__name__}:\n{error}\n```"
16
        )
17
18
19
setup = ErrorHandler
20