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