diff --git a/terminatorlib/configfile.py b/terminatorlib/configfile.py index ee6e5e56..f7c0374e 100644 --- a/terminatorlib/configfile.py +++ b/terminatorlib/configfile.py @@ -144,12 +144,10 @@ class ConfigFile: if self._line[self._pos:] != '': raise ConfigSyntaxError(_("Unexpected token"), self) - self._line_ok() except ConfigSyntaxError, e: - if self.errors_are_fatal: - raise e - else: - self.errors.append(e) + self._line_error(e) + else: + self._line_ok() if self.errors: raise ParsedWithErrors(self.filename, self.errors) @@ -176,3 +174,11 @@ class ConfigFile: finally: self._currvalue = None + def _line_error(self, e): + self._currvalue = None + if self.errors_are_fatal: + raise e + else: + self.errors.append(e) + +