I'm writing a parser for a certain file format. If a file is not correctly formatted (and can not be parsed) then the parser throws an exception.
What exception class, in the Python 2 exception hierarchy, should I use?
I'm writing a parser for a certain file format. If a file is not correctly formatted (and can not be parsed) then the parser throws an exception.
What exception class, in the Python 2 exception hierarchy, should I use?
How about
class XyzParseError(Exception):
pass
where XyzParser
is the name of your parser class? That's also what HTMLParser
in the standard library does.