Skip to content

Commit 97850d1

Browse files
config changes
1 parent 90ff9ff commit 97850d1

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

contentstack/errors.py

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""
22
* MIT License
3-
*
43
* Copyright (c) 2012 - 2019 Contentstack
54
*
65
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,17 +22,15 @@
2322
*
2423
"""
2524

26-
import logging
2725

28-
"""
26+
class HTTPError(Exception):
27+
28+
"""
2929
contentstack.error
3030
~~~~~~~~~~~~~~~~~~
3131
This module implements the Error class.
3232
API Reference: https://www.contentstack.com/docs/apis/content-delivery-api/#error
33-
34-
"""
35-
36-
class HTTPError(Exception):
33+
"""
3734

3835
errors_str = {
3936

@@ -52,9 +49,7 @@ class HTTPError(Exception):
5249
'Error_Query_Filter_Exception': "Please provide valid params."
5350
}
5451

55-
56-
def __init__(self):
57-
errors = {
52+
error_code = {
5853

5954
400: "The request was incorrect or corrupted.",
6055
401: "The login credentials are invalid.",
@@ -68,6 +63,41 @@ def __init__(self):
6863
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."
6964
}
7065

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."
98+
99+
}
100+
71101
def get_error(self, response):
72102
print('Error')
73103

0 commit comments

Comments
 (0)