Skip to content

Commit a3ebc2b

Browse files
committed
feat(errors): renamed ERROR_TEMPLATE and moved it
1 parent 4243a13 commit a3ebc2b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

gedcom/errors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
Module containing the exception handling classes.
1616
"""
1717

18+
ERROR_LINE_VIOLATION_TEMPLATE = "Line <{0}:{1}> of document violates GEDCOM format {2}\nSee: {3}"
19+
1820

1921
class GedcomFormatViolationError(Exception):
2022
"""Raised when the document format does not appear to conform

gedcom/parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@
3131
from gedcom.elements.individual import IndividualElement
3232
from gedcom.elements.root import RootElement
3333

34+
from gedcom.errors import ERROR_LINE_VIOLATION_TEMPLATE
3435
from gedcom.errors import GedcomVersionUnsupportedError
3536
from gedcom.errors import GedcomFormatUnsupportedError
3637
from gedcom.errors import GedcomFormatViolationError
3738
from gedcom.errors import NotAnActualIndividualError
3839
from gedcom.errors import NotAnActualFamilyError
3940

40-
ERROR_TEMPLATE = "Line <{0}:{1}> of document violates GEDCOM format {2}\nSee: {3}"
41-
4241
FAMILY_MEMBERS_TYPE_ALL = "ALL"
4342
FAMILY_MEMBERS_TYPE_CHILDREN = tags.GEDCOM_TAG_CHILD
4443
FAMILY_MEMBERS_TYPE_HUSBAND = tags.GEDCOM_TAG_HUSBAND
@@ -192,7 +191,7 @@ def __parse_line(line_number: int, line: str, last_element: Element,
192191

193192
if regex_match is None:
194193
if strict:
195-
errmsg = ERROR_TEMPLATE.format(line_number, line, '5.5.1', standards.GEDCOM_5_5_1)
194+
errmsg = ERROR_LINE_VIOLATION_TEMPLATE.format(line_number, line, '5.5.1', standards.GEDCOM_5_5_1)
196195
raise GedcomFormatViolationError(errmsg)
197196

198197
# Quirk check - see if this is a line without a CRLF (which could be the last line)

0 commit comments

Comments
 (0)