Skip to content

Commit

Permalink
Merge pull request Thriftpy#322 from jparise/parser-errors
Browse files Browse the repository at this point in the history
Improve exception message spelling and spacing
  • Loading branch information
hit9 committed Dec 19, 2017
2 parents dc56f4c + 5a97378 commit c49a3ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def test_e_load_fp():
with pytest.raises(ThriftParserError) as excinfo:
with open('parser-cases/tutorial.thrift') as thrift_fp:
load_fp(thrift_fp, 'tutorial_thrift')
assert ('Unexcepted include statement while loading'
assert ('Unexpected include statement while loading '
'from file like object.') == str(excinfo.value)


Expand Down
6 changes: 3 additions & 3 deletions thriftpy/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def p_include(p):
'''include : INCLUDE LITERAL'''
thrift = thrift_stack[-1]
if thrift.__thrift_file__ is None:
raise ThriftParserError('Unexcepted include statement while loading'
raise ThriftParserError('Unexpected include statement while loading '
'from file like object.')
replace_include_dirs = [os.path.dirname(thrift.__thrift_file__)] \
+ include_dirs_
Expand Down Expand Up @@ -598,8 +598,8 @@ def parse_fp(source, module_name, lexer=None, parser=None, enable_cache=True):
return thrift_cache[module_name]

if not hasattr(source, 'read'):
raise ThriftParserError('Except `source` to be a file-like object with'
'a method named \'read\'')
raise ThriftParserError('Expected `source` to be a file-like object '
'with a method named \'read\'')

if lexer is None:
lexer = lex.lex()
Expand Down

0 comments on commit c49a3ad

Please sign in to comment.