Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/multipart/exceptions.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 06:12 +0000

1class FormParserError(ValueError): 

2 """Base error class for our form parser.""" 

3 pass 

4 

5 

6class ParseError(FormParserError): 

7 """This exception (or a subclass) is raised when there is an error while 

8 parsing something. 

9 """ 

10 

11 #: This is the offset in the input data chunk (*NOT* the overall stream) in 

12 #: which the parse error occurred. It will be -1 if not specified. 

13 offset = -1 

14 

15 

16class MultipartParseError(ParseError): 

17 """This is a specific error that is raised when the MultipartParser detects 

18 an error while parsing. 

19 """ 

20 pass 

21 

22 

23class QuerystringParseError(ParseError): 

24 """This is a specific error that is raised when the QuerystringParser 

25 detects an error while parsing. 

26 """ 

27 pass 

28 

29 

30class DecodeError(ParseError): 

31 """This exception is raised when there is a decoding error - for example 

32 with the Base64Decoder or QuotedPrintableDecoder. 

33 """ 

34 pass 

35 

36 

37# On Python 3.3, IOError is the same as OSError, so we don't want to inherit 

38# from both of them. We handle this case below. 

39if IOError is not OSError: # pragma: no cover 

40 class FileError(FormParserError, IOError, OSError): 

41 """Exception class for problems with the File class.""" 

42 pass 

43else: # pragma: no cover 

44 class FileError(FormParserError, OSError): 

45 """Exception class for problems with the File class.""" 

46 pass