1class FormParserError(ValueError):
2 """Base error class for our form parser."""
3
4
5class ParseError(FormParserError):
6 """This exception (or a subclass) is raised when there is an error while
7 parsing something.
8 """
9
10 def __init__(self, message: str, *, offset: int = -1) -> None:
11 super().__init__(message)
12 self.offset = offset
13
14
15class MultipartParseError(ParseError):
16 """This is a specific error that is raised when the MultipartParser detects
17 an error while parsing.
18 """
19
20
21class QuerystringParseError(ParseError):
22 """This is a specific error that is raised when the QuerystringParser
23 detects an error while parsing.
24 """
25
26
27class DecodeError(ParseError):
28 """This exception is raised when there is a decoding error - for example
29 with the Base64Decoder or QuotedPrintableDecoder.
30 """
31
32
33class FileError(FormParserError, OSError):
34 """Exception class for problems with the File class."""