You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contentstack/errors.py
+40-10Lines changed: 40 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
"""
2
2
* MIT License
3
-
*
4
3
* Copyright (c) 2012 - 2019 Contentstack
5
4
*
6
5
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,17 +22,15 @@
23
22
*
24
23
"""
25
24
26
-
importlogging
27
25
28
-
"""
26
+
classHTTPError(Exception):
27
+
28
+
"""
29
29
contentstack.error
30
30
~~~~~~~~~~~~~~~~~~
31
31
This module implements the Error class.
32
32
API Reference: https://www.contentstack.com/docs/apis/content-delivery-api/#error
33
-
34
-
"""
35
-
36
-
classHTTPError(Exception):
33
+
"""
37
34
38
35
errors_str= {
39
36
@@ -52,9 +49,7 @@ class HTTPError(Exception):
52
49
'Error_Query_Filter_Exception': "Please provide valid params."
53
50
}
54
51
55
-
56
-
def__init__(self):
57
-
errors= {
52
+
error_code= {
58
53
59
54
400: "The request was incorrect or corrupted.",
60
55
401: "The login credentials are invalid.",
@@ -68,6 +63,41 @@ def __init__(self):
68
63
504: "A server did not receive a timely response from another server that it was accessing while attempting to load the web page or fill another request by the browser."
69
64
}
70
65
66
+
exceptions= {
67
+
68
+
AssertionError: "Raised when the assert statement fails.",
69
+
AttributeError: "Raised on the attribute assignment or reference fails.",
70
+
EOFError: "Raised when the input() function hits the end-of-file condition.",
71
+
FloatingPointError: "Raised when a floating point operation fails.",
72
+
GeneratorExit: "Raised when a generator's close() method is called.",
73
+
ImportError: "Raised when the imported module is not found.",
74
+
IndexError: "Raised when the index of a sequence is out of range.",
75
+
KeyError: "Raised when a key is not found in a dictionary.",
76
+
KeyboardInterrupt: "Raised when the user hits the interrupt key (Ctrl+c or delete).",
77
+
MemoryError: "Raised when an operation runs out of memory.",
78
+
NameError: "Raised when a variable is not found in the local or global scope.",
79
+
NotImplementedError: "Raised by abstract methods.",
80
+
OSError: "Raised when a system operation causes a system-related error.",
81
+
OverflowError: "Raised when the result of an arithmetic operation is too large to be represented.",
82
+
ReferenceError: "Raised when a weak reference proxy is used to access a garbage collected referent.",
83
+
RuntimeError: "Raised when an error does not fall under any other category.",
84
+
StopIteration: "Raised by the next() function to indicate that there is no further item to be returned by the iterator.",
85
+
SyntaxError: "Raised by the parser when a syntax error is encountered.",
86
+
IndentationError: "Raised when there is an incorrect indentation.",
87
+
TabError: "Raised when the indentation consists of inconsistent tabs and spaces.",
88
+
SystemError: "Raised when the interpreter detects internal error.",
89
+
SystemExit: "Raised by the sys.exit() function.",
90
+
TypeError: "Raised when a function or operation is applied to an object of an incorrect type.",
91
+
UnboundLocalError: "Raised when a reference is made to a local variable in a function or method, but no value has been bound to that variable.",
92
+
UnicodeError: "Raised when a Unicode-related encoding or decoding error occurs.",
93
+
UnicodeEncodeError: "Raised when a Unicode-related error occurs during encoding.",
94
+
UnicodeDecodeError: "Raised when a Unicode-related error occurs during decoding.",
95
+
UnicodeTranslateError: "Raised when a Unicode-related error occurs during translation.",
96
+
ValueError: "Raised when a function gets an argument of correct type but improper value.",
97
+
ZeroDivisionError: "Raised when the second operand of a division or module operation is zero."
0 commit comments