Skip to content

Show traceback in else for error handler #15

@Phxntxm

Description

@Phxntxm

There's one detail I want to be nitpicky about in the error handler section. I'm one of the helpers from the d.py server, so this want comes from seeing what users come in with. It's often that someone sets up an error handler, and doesn't have some kind of else: do something in it, leaving them with silenced errors and no idea what to do about it.

This tutorial does have an else, but just says "oh no something went wrong", not giving any actual details about what went wrong. I'd recommend doing this:

    traceback_list = traceback.format_exception(type(error), error, error.__traceback__)
    traceback_format = f"```\n{''.join(traceback_list)}```"

    await ctx.send(traceback_format)

This will give a nice traceback in the channel the command is sent in with the traceback needed to figure out what's going wrong.
image

The reason I don't like the current way it's done is for people who don't yet know that much, their first attempt will be to do await ctx.send(error) or something similar, which is simply not enough information to actually figure out the issue more times than not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions