Skip to content

Conversation

onerandomusername
Copy link
Member

Reduce the length of the traceback and provide a helpful error message
when a user forgets to import a type used in a command parameter annotation
outside of a TYPE_CHECKING block.

Reduce the length of the traceback and provide a helpful error message
when a user forgets to import a type used in a command parameter annotation
outside of a TYPE_CHECKING block.
@onerandomusername onerandomusername added the s: needs review Issue/PR is awaiting reviews label Sep 30, 2025
Copy link

read-the-docs-community bot commented Sep 30, 2025

Documentation build overview

📚 disnake | 🛠️ Build #29820764 | 📁 Comparing 3953a4b against latest (613e01d)


🔍 Preview build

Show files changed (48 files in total): 📝 48 modified | ➕ 0 added | ➖ 0 deleted
File Status
index.html 📝 modified
whats_new.html 📝 modified
api/abc.html 📝 modified
api/activities.html 📝 modified
api/app_commands.html 📝 modified
api/app_info.html 📝 modified
api/audit_logs.html 📝 modified
api/automod.html 📝 modified
api/channels.html 📝 modified
api/clients.html 📝 modified
api/components.html 📝 modified
api/emoji.html 📝 modified
api/entitlements.html 📝 modified
api/events.html 📝 modified
api/exceptions.html 📝 modified
api/guild_scheduled_events.html 📝 modified
api/guilds.html 📝 modified
api/integrations.html 📝 modified
api/interactions.html 📝 modified
api/invites.html 📝 modified
api/localization.html 📝 modified
api/members.html 📝 modified
api/messages.html 📝 modified
api/misc.html 📝 modified
api/permissions.html 📝 modified
api/roles.html 📝 modified
api/skus.html 📝 modified
api/soundboard.html 📝 modified
api/stage_instances.html 📝 modified
api/stickers.html 📝 modified
api/subscriptions.html 📝 modified
api/ui.html 📝 modified
api/users.html 📝 modified
api/utilities.html 📝 modified
api/voice.html 📝 modified
api/webhooks.html 📝 modified
api/widgets.html 📝 modified
ext/tasks/index.html 📝 modified
ext/commands/api/app_commands.html 📝 modified
ext/commands/api/bots.html 📝 modified
ext/commands/api/checks.html 📝 modified
ext/commands/api/cogs.html 📝 modified
ext/commands/api/context.html 📝 modified
ext/commands/api/converters.html 📝 modified
ext/commands/api/exceptions.html 📝 modified
ext/commands/api/help_commands.html 📝 modified
ext/commands/api/misc.html 📝 modified
ext/commands/api/prefix_commands.html 📝 modified

@onerandomusername onerandomusername added p: medium Medium priority t: enhancement New feature labels Sep 30, 2025
@onerandomusername onerandomusername self-assigned this Sep 30, 2025
except NameError as e:
raise NameError(
"Stringified params annotations must have their reference imported outside of a TYPE_CHECKING block: "
+ e.args[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ e.args[0]
+ str(e)

Comment on lines +313 to +314
"Could not expand parameters. Please check all annotations are imported outside of TYPE_CHECKING blocks. "
+ e.args[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Could not expand parameters. Please check all annotations are imported outside of TYPE_CHECKING blocks. "
+ e.args[0]
"Could not expand parameters. Please check all annotations are imported outside of TYPE_CHECKING blocks. Error: "
+ str(e)

Comment on lines +486 to +487
"Could not expand parameter options. Please check all annotations are imported outside of TYPE_CHECKING blocks. "
+ e.args[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Could not expand parameter options. Please check all annotations are imported outside of TYPE_CHECKING blocks. "
+ e.args[0]
"Could not expand parameter options. Please check all annotations are imported outside of TYPE_CHECKING blocks. Error: "
+ str(e)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: medium Medium priority s: needs review Issue/PR is awaiting reviews t: enhancement New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants