File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 5
5
6
6
from .. import format as odmlfmt
7
7
from ..info import FORMAT_VERSION
8
- from .parser_utils import ParserException
8
+ from .parser_utils import InvalidVersionException , ParserException
9
9
10
10
11
11
class DictWriter :
@@ -131,7 +131,7 @@ def to_odml(self, parsed_doc):
131
131
msg = ("Cannot read file: invalid odML document format version '%s'. \n "
132
132
"This package supports odML format versions: '%s'."
133
133
% (self .parsed_doc .get ('odml-version' ), FORMAT_VERSION ))
134
- raise ParserException (msg )
134
+ raise InvalidVersionException (msg )
135
135
136
136
self .parsed_doc = self .parsed_doc ['Document' ]
137
137
Original file line number Diff line number Diff line change @@ -11,3 +11,10 @@ class ParserException(Exception):
11
11
Exception wrapper used by various odML parsers.
12
12
"""
13
13
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 18
18
19
19
from .. import format
20
20
from ..info import FORMAT_VERSION
21
- from .parser_utils import ParserException
21
+ from .parser_utils import InvalidVersionException , ParserException
22
22
23
23
try :
24
24
unicode = unicode
@@ -162,7 +162,7 @@ def _handle_version(root):
162
162
msg = ("Cannot read file: invalid odML document format version '%s'. \n "
163
163
"This package supports odML format versions: '%s'."
164
164
% (root .attrib ['version' ], FORMAT_VERSION ))
165
- raise ParserException (msg )
165
+ raise InvalidVersionException (msg )
166
166
167
167
def from_file (self , xml_file ):
168
168
"""
You can’t perform that action at this time.
0 commit comments