Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pyasn1/error.py: 70%

10 statements  

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

1# 

2# This file is part of pyasn1 software. 

3# 

4# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> 

5# License: http://snmplabs.com/pyasn1/license.html 

6# 

7 

8 

9class PyAsn1Error(Exception): 

10 """Base pyasn1 exception 

11 

12 `PyAsn1Error` is the base exception class (based on 

13 :class:`Exception`) that represents all possible ASN.1 related 

14 errors. 

15 """ 

16 

17 

18class ValueConstraintError(PyAsn1Error): 

19 """ASN.1 type constraints violation exception 

20 

21 The `ValueConstraintError` exception indicates an ASN.1 value 

22 constraint violation. 

23 

24 It might happen on value object instantiation (for scalar types) or on 

25 serialization (for constructed types). 

26 """ 

27 

28 

29class SubstrateUnderrunError(PyAsn1Error): 

30 """ASN.1 data structure deserialization error 

31 

32 The `SubstrateUnderrunError` exception indicates insufficient serialised 

33 data on input of a de-serialization codec. 

34 """ 

35 

36 

37class PyAsn1UnicodeError(PyAsn1Error, UnicodeError): 

38 """Unicode text processing error 

39 

40 The `PyAsn1UnicodeError` exception is a base class for errors relating to 

41 unicode text de/serialization. 

42 

43 Apart from inheriting from :class:`PyAsn1Error`, it also inherits from 

44 :class:`UnicodeError` to help the caller catching unicode-related errors. 

45 """ 

46 def __init__(self, message, unicode_error=None): 

47 if isinstance(unicode_error, UnicodeError): 

48 UnicodeError.__init__(self, *unicode_error.args) 

49 PyAsn1Error.__init__(self, message) 

50 

51 

52class PyAsn1UnicodeDecodeError(PyAsn1UnicodeError, UnicodeDecodeError): 

53 """Unicode text decoding error 

54 

55 The `PyAsn1UnicodeDecodeError` exception represents a failure to 

56 deserialize unicode text. 

57 

58 Apart from inheriting from :class:`PyAsn1UnicodeError`, it also inherits 

59 from :class:`UnicodeDecodeError` to help the caller catching unicode-related 

60 errors. 

61 """ 

62 

63 

64class PyAsn1UnicodeEncodeError(PyAsn1UnicodeError, UnicodeEncodeError): 

65 """Unicode text encoding error 

66 

67 The `PyAsn1UnicodeEncodeError` exception represents a failure to 

68 serialize unicode text. 

69 

70 Apart from inheriting from :class:`PyAsn1UnicodeError`, it also inherits 

71 from :class:`UnicodeEncodeError` to help the caller catching 

72 unicode-related errors. 

73 """ 

74 

75