Skip to content

Commit e8f67c9

Browse files
committed
improve error handling of invalid files
1 parent 17d6f65 commit e8f67c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/robot/parsing/lexerwrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class LexerWrapper(object):
2525
def __init__(self, lexer, source):
2626
self.source = source
2727
self.curdir = os.path.dirname(source).replace('\\', '\\\\')
28-
lexer.input(Utf8Reader(self._open(source)).read())
28+
lexer.input(self._read(source))
2929
self.tokens = lexer.get_tokens()
3030

31-
def _open(self, path):
31+
def _read(self, path):
3232
try:
3333
# IronPython handles BOM incorrectly if not using binary mode:
3434
# https://ironpython.codeplex.com/workitem/34655
35-
return open(path, 'rb')
35+
return Utf8Reader(open(path, 'rb')).read()
3636
except:
3737
raise DataError(get_error_message())
3838

0 commit comments

Comments
 (0)