aboutsummaryrefslogtreecommitdiffstats
path: root/bsie/reader/chain.py
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2023-02-08 19:24:37 +0100
committerMatthias Baumgartner <dev@igsor.net>2023-02-08 19:24:37 +0100
commit0d0144466919cfb168e75c2af26d5cb74e10bfa0 (patch)
treed280d9d1e19e4f7a9d0d4b5405603c729e1fdcce /bsie/reader/chain.py
parenta281d6b3a75a7d4a97e673c285ee430a327482ed (diff)
downloadbsie-0d0144466919cfb168e75c2af26d5cb74e10bfa0.tar.gz
bsie-0d0144466919cfb168e75c2af26d5cb74e10bfa0.tar.bz2
bsie-0d0144466919cfb168e75c2af26d5cb74e10bfa0.zip
minor cleanup
Diffstat (limited to 'bsie/reader/chain.py')
-rw-r--r--bsie/reader/chain.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/bsie/reader/chain.py b/bsie/reader/chain.py
index 5e9e0d5..1dbc52b 100644
--- a/bsie/reader/chain.py
+++ b/bsie/reader/chain.py
@@ -73,16 +73,19 @@ class ReaderChain(base.Reader, typing.Generic[T_CONTENT]):
return hash((super().__hash__(), self._children))
def __call__(self, path: str) -> T_CONTENT:
- raise_error = errors.UnsupportedFileFormatError
+ raise_error = False
for child in self._children:
try:
return child(path)
except errors.UnsupportedFileFormatError:
+ # child cannot read the file, skip.
pass
except errors.ReaderError:
- # child cannot read the file, skip.
- raise_error = errors.ReaderError # type: ignore [assignment] # mypy is confused
+ # child failed to read the file, skip.
+ raise_error = True
- raise raise_error(path)
+ if raise_error:
+ raise errors.ReaderError(path)
+ raise errors.UnsupportedFileFormatError(path)
## EOF ##