Merge pull request #3545 from InspectorCaracal/patch-28

Fix cmdhandler error-handling issues
This commit is contained in:
Griatch 2024-06-14 12:19:24 +02:00 committed by GitHub
commit 2f3a882984
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -350,7 +350,7 @@ def get_and_merge_cmdsets(
"""
# Gather cmdsets from location, objects in location or carried
try:
local_obj_cmdsets = [None]
local_obj_cmdsets = []
try:
location = obj.location
except Exception:
@ -438,11 +438,12 @@ def get_and_merge_cmdsets(
cmdset for cmdset in object_cmdsets if cmdset and cmdset.key != "_EMPTY_CMDSET"
]
# report cmdset errors to user (these should already have been logged)
yield [
report_to.msg(err_helper(cmdset.errmessage, cmdid=cmdid))
for cmdset in cmdsets
if cmdset.key == "_CMDSET_ERROR"
]
if report_to:
yield [
report_to.msg(err_helper(cmdset.errmessage, cmdid=cmdid))
for cmdset in cmdsets
if cmdset.key == "_CMDSET_ERROR"
]
if cmdsets:
# faster to do tuple on list than to build tuple directly