Fix T75973: don't show raw Python errors to users for invalid shortcut paths

There are cases when a user can accidentally assign an operator to toggle an
invalid property to e.g. left click, which shows Python errors to the users.
Rather than throw an error and e.g. break 3D viewport selection for the user,
just print an error to the console.

The root cause of such bugs should be fixed as well, but a working Blender
is most important here.
This commit is contained in:
Brecht Van Lommel 2020-04-22 08:59:37 +02:00
parent 90f01d5048
commit 4adc68bdf8
Notes: blender-bot 2023-02-14 04:31:04 +01:00
Referenced by issue #75973, Traceback error
1 changed files with 4 additions and 2 deletions

View File

@ -87,8 +87,10 @@ def context_path_validate(context, data_path):
# One of the items in the rna path is None, just ignore this
value = Ellipsis
else:
# We have a real error in the rna path, don't ignore that
raise
# Print invalid path, but don't show error to the users and fully
# break the UI if the operator is bound to an event like left click.
print("context_path_validate error: context.%s not found (invalid keymap entry?)" % data_path)
value = Ellipsis
return value