Skip to content
Snippets Groups Projects
Commit 5a585425 authored by Andreas Freise's avatar Andreas Freise
Browse files

adding pkex to a lot of exception calls.

parent fed6f816
No related branches found
No related tags found
No related merge requests found
...@@ -146,7 +146,7 @@ class kat(object): ...@@ -146,7 +146,7 @@ class kat(object):
self.__time_code = None self.__time_code = None
if kat_code != None and kat_file != None: if kat_code != None and kat_file != None:
raise BasePyKatException("Specify either a Kat file or some Kat code, not both.") raise pkex.BasePyKatException("Specify either a Kat file or some Kat code, not both.")
if kat_code != None: if kat_code != None:
self.parseCommands(kat_code) self.parseCommands(kat_code)
...@@ -304,7 +304,7 @@ class kat(object): ...@@ -304,7 +304,7 @@ class kat(object):
katfile.flush() katfile.flush()
katfile.close() katfile.close()
except BasePyKatException as ex: except pkex.BasePyKatException as ex:
print ex print ex
def run(self, printout=0, printerr=0, save_output=False, save_kat=False,kat_name=None) : def run(self, printout=0, printerr=0, save_output=False, save_kat=False,kat_name=None) :
...@@ -313,6 +313,8 @@ class kat(object): ...@@ -313,6 +313,8 @@ class kat(object):
It returns a katRun object which is populated with the various It returns a katRun object which is populated with the various
data from the simulation run. data from the simulation run.
""" """
start = datetime.datetime.now()
try: try:
if not hasattr(self, "xaxis"): if not hasattr(self, "xaxis"):
...@@ -342,7 +344,6 @@ class kat(object): ...@@ -342,7 +344,6 @@ class kat(object):
raise MissingFinesse() raise MissingFinesse()
print "--------------------------------------------------------------" print "--------------------------------------------------------------"
start = datetime.datetime.now()
print "Running kat - Started at " + str(start) print "Running kat - Started at " + str(start)
if hasattr(self, "x2axis"): if hasattr(self, "x2axis"):
...@@ -467,7 +468,7 @@ class kat(object): ...@@ -467,7 +468,7 @@ class kat(object):
else: else:
return r return r
except FinesseRunError as fe: except pkex.BasePyKatException as fe:
print fe print fe
finally: finally:
print "" print ""
...@@ -482,7 +483,7 @@ class kat(object): ...@@ -482,7 +483,7 @@ class kat(object):
if isinstance(obj, Component): if isinstance(obj, Component):
if obj.name in self.__components : if obj.name in self.__components :
raise BasePyKatException("A component with name '{0}' has already been added".format([obj.name])) raise pkex.BasePyKatException("A component with name '{0}' has already been added".format([obj.name]))
self.__components[obj.name] = obj self.__components[obj.name] = obj
self.__add_component(obj) self.__add_component(obj)
...@@ -490,7 +491,7 @@ class kat(object): ...@@ -490,7 +491,7 @@ class kat(object):
elif isinstance(obj, Detector): elif isinstance(obj, Detector):
if obj.name in self.__detectors : if obj.name in self.__detectors :
raise BasePyKatException("A detector '{0}' has already been added".format(obj.name)) raise pkex.BasePyKatException("A detector '{0}' has already been added".format(obj.name))
self.__detectors[obj.name] = obj self.__detectors[obj.name] = obj
self.__add_detector(obj) self.__add_detector(obj)
...@@ -501,11 +502,11 @@ class kat(object): ...@@ -501,11 +502,11 @@ class kat(object):
self.__add_command(obj) self.__add_command(obj)
else : else :
raise BasePyKatException("Object {0} could not be added".format(obj)) raise pkex.BasePyKatException("Object {0} could not be added".format(obj))
obj._on_kat_add(self) obj._on_kat_add(self)
except BasePyKatException as ex: except pkex.BasePyKatException as ex:
print ex print ex
def readOutFile(self, filename): def readOutFile(self, filename):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment