diff --git a/pylot/core/read/inputs.py b/pylot/core/read/inputs.py index cd66e845..d4b30a49 100644 --- a/pylot/core/read/inputs.py +++ b/pylot/core/read/inputs.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from pylot.core.util.errors import ParameterError class AutoPickParameter(object): ''' @@ -57,7 +58,7 @@ class AutoPickParameter(object): for line in lines: parspl = line.split('\t')[:2] parFileCont[parspl[0].strip()] = parspl[1] - except Exception as e: + except IndexError as e: self._printParameterError(e) inputFile.seek(0) lines = inputFile.readlines() @@ -136,11 +137,13 @@ class AutoPickParameter(object): return self.__getitem__(param) except KeyError as e: self._printParameterError(e) + raise ParameterError(e) except TypeError: try: return self.__getitem__(args) except KeyError as e: self._printParameterError(e) + raise ParameterError(e) def setParam(self, **kwargs): for param, value in kwargs.items(): diff --git a/pylot/core/util/errors.py b/pylot/core/util/errors.py index daf21d46..8b28a348 100644 --- a/pylot/core/util/errors.py +++ b/pylot/core/util/errors.py @@ -20,3 +20,6 @@ class DatastructureError(Exception): class OverwriteError(IOError): pass + +class ParameterError(Exception): + pass \ No newline at end of file