Skip to content
Snippets Groups Projects
Commit 0bea7cec authored by Paweł Szostek's avatar Paweł Szostek
Browse files

Handle unexpected parsing errors in manfiests

parent 200ff96a
No related merge requests found
......@@ -218,17 +218,26 @@ class ConfigParser(object):
#This is important because in the manifests only certain group
#of variables is allowed. In arbitrary code all of them can be used.
arbitrary_options = {}
import sys
try:
exec(self.arbitrary_code, arbitrary_options)
except SyntaxError as e:
p.rawprint(str(e) + "\nInvalid syntax in the arbitraty code")
quit()
except:
p.rawprint("Unexpted error while parsing arbitrary code")
p.rawprint(str(sys.exc_info()[0])+':'+str(sys.exc_info()[1]))
quit()
try:
exec(content, options)
except SyntaxError as e:
p.rawprint(str(e)+ "\nInvalid syntax in the manifest file: " + self.file)
quit()
except:
p.rawprint("Encountered unexpected error while parsing " + self.file)
p.rawprint(str(sys.exc_info()[0]) +':'+ str(sys.exc_info()[1]))
quit()
for opt_name, val in list(options.items()): #check delivered options
if opt_name.startswith('__'):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment