From 771476a8d8c7eff4735ce83e46cf0a3d7c167688 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 6 Sep 2022 02:55:32 -0400 Subject: [PATCH] Fix _errors key being visible in CommandSyncError in some cases --- discord/app_commands/errors.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/discord/app_commands/errors.py b/discord/app_commands/errors.py index 69c40c899..3cc12c72d 100644 --- a/discord/app_commands/errors.py +++ b/discord/app_commands/errors.py @@ -499,7 +499,16 @@ def _get_command_error( for index, d in remaining.items(): _get_command_error(index, d, children, messages, indent=indent + 2) else: - errors = _flatten_error_dict(remaining, key=key) + if isinstance(remaining, dict): + try: + inner_errors = remaining['_errors'] + except KeyError: + errors = _flatten_error_dict(remaining, key=key) + else: + errors = {key: ' '.join(x.get('message', '') for x in inner_errors)} + else: + errors = _flatten_error_dict(remaining, key=key) + messages.extend(f'{indentation} {k}: {v}' for k, v in errors.items())