File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66from .. import format as odmlfmt
77from ..info import FORMAT_VERSION
8- from .parser_utils import ParserException
8+ from .parser_utils import InvalidVersionException , ParserException
99
1010
1111class DictWriter :
@@ -131,7 +131,7 @@ def to_odml(self, parsed_doc):
131131 msg = ("Cannot read file: invalid odML document format version '%s'. \n "
132132 "This package supports odML format versions: '%s'."
133133 % (self .parsed_doc .get ('odml-version' ), FORMAT_VERSION ))
134- raise ParserException (msg )
134+ raise InvalidVersionException (msg )
135135
136136 self .parsed_doc = self .parsed_doc ['Document' ]
137137
Original file line number Diff line number Diff line change @@ -11,3 +11,10 @@ class ParserException(Exception):
1111 Exception wrapper used by various odML parsers.
1212 """
1313 pass
14+
15+
16+ class InvalidVersionException (ParserException ):
17+ """
18+ Exception wrapper to indicate a non-compatible odML version.
19+ """
20+ pass
Original file line number Diff line number Diff line change 1818
1919from .. import format
2020from ..info import FORMAT_VERSION
21- from .parser_utils import ParserException
21+ from .parser_utils import InvalidVersionException , ParserException
2222
2323try :
2424 unicode = unicode
@@ -162,7 +162,7 @@ def _handle_version(root):
162162 msg = ("Cannot read file: invalid odML document format version '%s'. \n "
163163 "This package supports odML format versions: '%s'."
164164 % (root .attrib ['version' ], FORMAT_VERSION ))
165- raise ParserException (msg )
165+ raise InvalidVersionException (msg )
166166
167167 def from_file (self , xml_file ):
168168 """
You can’t perform that action at this time.
0 commit comments