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

17 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-05-02 06:19 +0000

1class UnpackException(Exception): 

2 """Base class for some exceptions raised while unpacking. 

3 

4 NOTE: unpack may raise exception other than subclass of 

5 UnpackException. If you want to catch all error, catch 

6 Exception instead. 

7 """ 

8 

9 

10class BufferFull(UnpackException): 

11 pass 

12 

13 

14class OutOfData(UnpackException): 

15 pass 

16 

17 

18class FormatError(ValueError, UnpackException): 

19 """Invalid msgpack format""" 

20 

21 

22class StackError(ValueError, UnpackException): 

23 """Too nested""" 

24 

25 

26# Deprecated. Use ValueError instead 

27UnpackValueError = ValueError 

28 

29 

30class ExtraData(UnpackValueError): 

31 """ExtraData is raised when there is trailing data. 

32 

33 This exception is raised while only one-shot (not streaming) 

34 unpack. 

35 """ 

36 

37 def __init__(self, unpacked, extra): 

38 self.unpacked = unpacked 

39 self.extra = extra 

40 

41 def __str__(self): 

42 return "unpack(b) received extra data." 

43 

44 

45# Deprecated. Use Exception instead to catch all exception during packing. 

46PackException = Exception 

47PackValueError = ValueError 

48PackOverflowError = OverflowError