diff --git a/etiquette/photodb.py b/etiquette/photodb.py index e2c2acf..570cc4c 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -831,7 +831,11 @@ class PDBTagMixin: tagname = tagname.strip('.+') tagname = tagname.split('.')[-1].split('+')[0] - tagname = self.normalize_tagname(tagname) + + try: + tagname = self.normalize_tagname(tagname) + except (exceptions.TagTooShort, exceptions.TagTooLong): + raise exceptions.NoSuchTag(tagname) cur = self.sql.cursor() while True: diff --git a/etiquette/searchhelpers.py b/etiquette/searchhelpers.py index 088eed5..6db8c2a 100644 --- a/etiquette/searchhelpers.py +++ b/etiquette/searchhelpers.py @@ -423,12 +423,7 @@ def normalize_tag_mmf(tags, photodb, warning_bag=None): try: tag = photodb.get_tag(name=tag) - exc = None - except exceptions.NoSuchTag as e: - exc = e - except (exceptions.TagTooShort, exceptions.TagTooLong) as e: - exc = exceptions.NoSuchTag(tag) - if exc is not None: + except exceptions.NoSuchTag as exc: if warning_bag: warning_bag.add(exc.error_message) continue