mirror of
https://github.com/evennia/evennia.git
synced 2026-04-02 05:57:16 +02:00
Handle try..except overriding variable scope
This commit is contained in:
parent
f8084c0977
commit
8cdc641ffc
2 changed files with 9 additions and 9 deletions
|
|
@ -227,19 +227,19 @@ def _validate_prototype(prototype):
|
|||
|
||||
txt = protlib.prototype_to_str(prototype)
|
||||
errors = "\n\n|g No validation errors found.|n (but errors could still happen at spawn-time)"
|
||||
has_err = False
|
||||
err = False
|
||||
try:
|
||||
# validate, don't spawn
|
||||
spawner.spawn(prototype, only_validate=True)
|
||||
except RuntimeError as err:
|
||||
errors = "\n\n|r{}|n".format(err)
|
||||
has_err = True
|
||||
except RuntimeError as exc:
|
||||
errors = "\n\n|r{}|n".format(exc)
|
||||
err = True
|
||||
except RuntimeWarning as err:
|
||||
errors = "\n\n|y{}|n".format(err)
|
||||
has_err = True
|
||||
errors = "\n\n|y{}|n".format(exc)
|
||||
err = True
|
||||
|
||||
text = (txt + errors)
|
||||
return has_err, text
|
||||
return err, text
|
||||
|
||||
|
||||
def _format_protfuncs():
|
||||
|
|
|
|||
|
|
@ -588,8 +588,8 @@ def protfunc_parser(value, available_functions=None, testing=False, stacktrace=F
|
|||
result = literal_eval(result)
|
||||
except ValueError:
|
||||
pass
|
||||
except Exception as err:
|
||||
err = str(err)
|
||||
except Exception as exc:
|
||||
err = str(exc)
|
||||
if testing:
|
||||
return err, result
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue