Skip to content

Commit

Permalink
do not include line no in the error msg
Browse files Browse the repository at this point in the history
- it doesn't work
- 'invalid encoding after line x' makes no sense
- line no with invalid chars is already reported by the csv reader exception
  • Loading branch information
sellth committed Nov 2, 2023
1 parent a883c7e commit 811d254
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions altamisa/isatab/parse_assay_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,7 @@ def _read_next_line(self):
except StopIteration:
self._line = None
except UnicodeDecodeError as e: # pragma: no cover
tpl = "Invalid encoding after line {} of study file '{}' (use Unicode/UTF-8)."
msg = tpl.format(self._reader.line_num, self.filename)
msg = f"Invalid encoding of study file '{self._filename}' (use Unicode/UTF-8)."
raise ParseIsatabException(msg) from e
return prev_line

Expand Down Expand Up @@ -893,8 +892,7 @@ def _read_next_line(self):
except StopIteration:
self._line = None
except UnicodeDecodeError as e: # pragma: no cover
tpl = "Invalid encoding after line {} of assay file '{}' (use Unicode/UTF-8)."
msg = tpl.format(self._reader.line_num, self.filename)
msg = f"Invalid encoding of assay file '{self._filename}' (use Unicode/UTF-8)."
raise ParseIsatabException(msg) from e
return prev_line

Expand Down
3 changes: 1 addition & 2 deletions altamisa/isatab/parse_investigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ def _read_next_line(self):
except StopIteration:
self._line = None
except UnicodeDecodeError as e: # pragma: no cover
tpl = "Invalid encoding after line {} of investigation file '{}' (use Unicode/UTF-8)."
msg = tpl.format(self._reader.line_num, self._filename)
msg = f"Invalid encoding of investigation file '{self._filename}' (use Unicode/UTF-8)."
raise ParseIsatabException(msg) from e
return prev_line

Expand Down

0 comments on commit 811d254

Please sign in to comment.