Don't continue with compiling when function has error
This would give an exception which breaks the script and makes a very unclear chained error message. Contributes to issue CURA-2572.
Esse commit está contido em:
@@ -236,10 +236,13 @@ class Setting:
|
|||||||
compiled = compile(code, self._key, "eval")
|
compiled = compile(code, self._key, "eval")
|
||||||
except (SyntaxError, TypeError) as e:
|
except (SyntaxError, TypeError) as e:
|
||||||
print("Parse error in function (" + str(code) + ") for setting", self._key + ":", str(e))
|
print("Parse error in function (" + str(code) + ") for setting", self._key + ":", str(e))
|
||||||
|
return None
|
||||||
except IllegalMethodError as e:
|
except IllegalMethodError as e:
|
||||||
print("Use of illegal method", str(e), "in function (" + code + ") for setting", self._key)
|
print("Use of illegal method", str(e), "in function (" + code + ") for setting", self._key)
|
||||||
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Exception in function (" + code + ") for setting", self._key + ":", str(e))
|
print("Exception in function (" + code + ") for setting", self._key + ":", str(e))
|
||||||
|
return None
|
||||||
|
|
||||||
return eval(compiled, globals(), locals)
|
return eval(compiled, globals(), locals)
|
||||||
|
|
||||||
|
|||||||
Referência em uma Nova Issue
Bloquear um usuário