Handle try..except overriding variable scope

This commit is contained in:
Griatch 2018-10-14 09:51:49 +02:00
parent f8084c0977
commit 8cdc641ffc
2 changed files with 9 additions and 9 deletions

View file

@ -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():

View file

@ -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