Skip to content

Commit

Permalink
add DeprecatedWarning when using ThriftGrammerError
Browse files Browse the repository at this point in the history
  • Loading branch information
aisk committed Sep 15, 2023
1 parent ca84a2a commit b852fce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions thriftpy2/parser/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import absolute_import

from warnings import warn


class ThriftParserError(Exception):
pass
Expand All @@ -13,3 +15,11 @@ class ThriftLexerError(ThriftParserError):

class ThriftGrammarError(ThriftParserError):
pass


def __getattr__(name):
if name == "ThriftGrammerError":
warn("'ThriftGrammerError' is a typo of 'ThriftGrammarError'", DeprecationWarning)
return ThriftGrammarError

raise AttributeError("module %r has no attribute %r" % (__name__, name))

0 comments on commit b852fce

Please sign in to comment.