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:
Ghostkeeper
2017-02-03 11:26:44 +01:00
commit ab7e035f6e
+3
Ver Arquivo
@@ -236,10 +236,13 @@ class Setting:
compiled = compile(code, self._key, "eval")
except (SyntaxError, TypeError) as e:
print("Parse error in function (" + str(code) + ") for setting", self._key + ":", str(e))
return None
except IllegalMethodError as e:
print("Use of illegal method", str(e), "in function (" + code + ") for setting", self._key)
return None
except Exception as e:
print("Exception in function (" + code + ") for setting", self._key + ":", str(e))
return None
return eval(compiled, globals(), locals)