Skip to content

Commit 75dc76a

Browse files
Merge pull request #4 from SlicingDice/feature/update_errors_code
Update API errors code
2 parents 9c7e40a + 9a8c4a8 commit 75dc76a

File tree

3 files changed

+154
-12
lines changed

3 files changed

+154
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
### Updated
4+
- Update API errors code
5+
36
## [1.0.0]
47
### Added
58
- Thin layers around SlicingDice API endpoints

pyslicer/core/helper_handler_exceptions.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@
1313
12: exceptions.AuthInvalidAPIKeyException,
1414
13: exceptions.AuthIncorrectPermissionException,
1515
14: exceptions.AuthInvalidRemoteException,
16+
15: exceptions.CustomKeyInvalidFieldCreationException,
1617
16: exceptions.CustomKeyInvalidPermissionForFieldException,
1718
17: exceptions.CustomKeyInvalidOperationException,
1819
18: exceptions.CustomKeyNotPermittedException,
1920
19: exceptions.CustomKeyRouteNotPermittedException,
20-
# Request validations (20 - 29)
21+
20: exceptions.DemoApiInvalidEndpointException,
22+
# Request validations (21 - 29)
2123
21: exceptions.RequestMissingContentTypeException,
2224
22: exceptions.RequestIncorrectContentTypeValueException,
2325
23: exceptions.RequestRateLimitException,
2426
24: exceptions.RequestInvalidJsonException,
27+
25: exceptions.RequestInvalidHttpMethodException,
28+
26: exceptions.RequestInvalidEndpointException,
29+
27: exceptions.RequestIncorrectHttpException,
30+
28: exceptions.RequestExceedLimitException,
2531
# Account Errors (30 - 39)
2632
30: exceptions.AccountMissingPaymentMethodException,
2733
31: exceptions.AccountPaymentRequiredException,
@@ -40,27 +46,35 @@
4046
49: exceptions.FieldInvalidApiNameException,
4147
50: exceptions.FieldInvalidNameException,
4248
51: exceptions.FieldInvalidDescriptionException,
49+
52: exceptions.FieldExceedDescriptionlengthException,
4350
53: exceptions.FieldInvalidCardinalityException,
4451
54: exceptions.FieldDecimalLimitException,
4552
55: exceptions.FieldRangeLimitException,
53+
56: exceptions.FieldExceededMaxNameLenghtException,
54+
57: exceptions.FieldExceededMaxApiNameLenghtException,
55+
58: exceptions.FieldEmptyEntityIdException,
56+
59: exceptions.FieldExceededPermitedValueException,
4657
# Index errors (60 - 79)
47-
60: exceptions.IndexEntityKeyTypeException,
58+
60: exceptions.IndexInvalidDecimalPlacesException,
4859
61: exceptions.IndexEntityValueTypeException,
4960
62: exceptions.IndexFieldNameTypeException,
5061
63: exceptions.IndexFieldTypeException,
5162
64: exceptions.IndexEntityNameTooBigException,
5263
65: exceptions.IndexFieldValueTooBigException,
53-
66: exceptions.IndexDateFormatException,
64+
66: exceptions.IndexTimeSeriesDateFormatException,
5465
67: exceptions.IndexFieldNotActiveException,
5566
68: exceptions.IndexIdLimitException,
5667
69: exceptions.IndexFieldLimitException,
68+
70: exceptions.IndexDateFormatException,
5769
71: exceptions.IndexFieldStringEmptyValueException,
5870
72: exceptions.IndexFieldTimeseriesInvalidParameterException,
5971
73: exceptions.IndexFieldNumericInvalidValueException,
6072
74: exceptions.IndexFieldTimeseriesMissingValueException,
6173
75: exceptions.QueryTimeSeriesInvalidPrecisionSecondsException,
6274
76: exceptions.QueryTimeSeriesInvalidPrecisionMinutesException,
6375
77: exceptions.QueryTimeSeriesInvalidPrecisionHoursException,
76+
78: exceptions.QueryDateFormatException,
77+
79: exceptions.QueryRelativeIntervalException,
6478
# Query errors (80 - 109)
6579
80: exceptions.QueryMissingQueryException,
6680
81: exceptions.QueryInvalidTypeException,
@@ -71,7 +85,7 @@
7185
86: exceptions.QueryMissingOperatorException,
7286
87: exceptions.QueryIncompleteException,
7387
88: exceptions.QueryEventCountQueryException,
74-
89: exceptions.QueryDateFormatException,
88+
89: exceptions.QueryInvalidMetricException,
7589
90: exceptions.QueryIntegerException,
7690
91: exceptions.QueryFieldLimitException,
7791
92: exceptions.QueryLevelLimitException,
@@ -83,7 +97,6 @@
8397
98: exceptions.QueryContainsNumericException,
8498
99: exceptions.QueryExistsEntityLimitException,
8599
100: exceptions.QueryMultipleFiltersException,
86-
101: exceptions.QueryContainsValueTypeException,
87100
102: exceptions.QueryMissingNameParamException,
88101
103: exceptions.QuerySavedAlreadyExistsException,
89102
104: exceptions.QuerySavedNotExistsException,
@@ -104,6 +117,12 @@
104117
119: exceptions.QueryCountInvalidParameterException,
105118
120: exceptions.QueryAggregationInvalidParameterException,
106119
121: exceptions.QueryAggregationInvalidFilterQueryException,
120+
122: exceptions.QueryInvalidMinfreqException,
121+
123: exceptions.QueryExceededMaxNumberQuerysException,
122+
124: exceptions.QueryInvalidOperatorUsageException,
123+
125: exceptions.QueryInvalidParameterUsageException,
124+
126: exceptions.QueryParameterInvalidFieldUsageException,
125+
127: exceptions.QueryInvalidFieldUsageException,
107126
# Internal errors (110 - 120)
108127
130: exceptions.InternalException,
109128
131: exceptions.FieldCreateInternalException

pyslicer/exceptions.py

Lines changed: 127 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def __init__(self, *args, **kwargs):
4242
self, *args, **kwargs)
4343

4444

45+
class CustomKeyInvalidFieldCreationException(SlicingDiceException):
46+
def __init__(self, *args, **kwargs):
47+
super(CustomKeyInvalidFieldCreationException, self).__init__(
48+
self, *args, **kwargs)
49+
50+
4551
class CustomKeyInvalidPermissionForFieldException(SlicingDiceException):
4652
def __init__(self, *args, **kwargs):
4753
super(CustomKeyInvalidPermissionForFieldException, self).__init__(
@@ -66,6 +72,12 @@ def __init__(self, *args, **kwargs):
6672
self, *args, **kwargs)
6773

6874

75+
class DemoApiInvalidEndpointException(SlicingDiceException):
76+
def __init__(self, *args, **kwargs):
77+
super(DemoApiInvalidEndpointException, self).__init__(
78+
self, *args, **kwargs)
79+
80+
6981
# Request validations
7082
class RequestMissingContentTypeException(SlicingDiceException):
7183
def __init__(self, *args, **kwargs):
@@ -91,6 +103,30 @@ def __init__(self, *args, **kwargs):
91103
self, *args, **kwargs)
92104

93105

106+
class RequestInvalidHttpMethodException(SlicingDiceException):
107+
def __init__(self, *args, **kwargs):
108+
super(RequestInvalidHttpMethodException, self).__init__(
109+
self, *args, **kwargs)
110+
111+
112+
class RequestInvalidEndpointException(SlicingDiceException):
113+
def __init__(self, *args, **kwargs):
114+
super(RequestInvalidEndpointException, self).__init__(
115+
self, *args, **kwargs)
116+
117+
118+
class RequestIncorrectHttpException(SlicingDiceException):
119+
def __init__(self, *args, **kwargs):
120+
super(RequestIncorrectHttpException, self).__init__(
121+
self, *args, **kwargs)
122+
123+
124+
class RequestExceedLimitException(SlicingDiceException):
125+
def __init__(self, *args, **kwargs):
126+
super(RequestExceedLimitException, self).__init__(
127+
self, *args, **kwargs)
128+
129+
94130
# Account Errors
95131
class AccountMissingPaymentMethodException(SlicingDiceException):
96132
def __init__(self, *args, **kwargs):
@@ -189,6 +225,12 @@ def __init__(self, *args, **kwargs):
189225
self, *args, **kwargs)
190226

191227

228+
class FieldExceedDescriptionlengthException(SlicingDiceException):
229+
def __init__(self, *args, **kwargs):
230+
super(FieldExceedDescriptionlengthException, self).__init__(
231+
self, *args, **kwargs)
232+
233+
192234
class FieldInvalidCardinalityException(SlicingDiceException):
193235
def __init__(self, *args, **kwargs):
194236
super(FieldInvalidCardinalityException, self).__init__(
@@ -207,10 +249,34 @@ def __init__(self, *args, **kwargs):
207249
self, *args, **kwargs)
208250

209251

252+
class FieldExceededMaxNameLenghtException(SlicingDiceException):
253+
def __init__(self, *args, **kwargs):
254+
super(FieldExceededMaxNameLenghtException, self).__init__(
255+
self, *args, **kwargs)
256+
257+
258+
class FieldExceededMaxApiNameLenghtException(SlicingDiceException):
259+
def __init__(self, *args, **kwargs):
260+
super(FieldExceededMaxApiNameLenghtException, self).__init__(
261+
self, *args, **kwargs)
262+
263+
264+
class FieldEmptyEntityIdException(SlicingDiceException):
265+
def __init__(self, *args, **kwargs):
266+
super(FieldEmptyEntityIdException, self).__init__(
267+
self, *args, **kwargs)
268+
269+
270+
class FieldExceededPermitedValueException(SlicingDiceException):
271+
def __init__(self, *args, **kwargs):
272+
super(FieldExceededPermitedValueException, self).__init__(
273+
self, *args, **kwargs)
274+
275+
210276
# Index errors
211-
class IndexEntityKeyTypeException(SlicingDiceException):
277+
class IndexInvalidDecimalPlacesException(SlicingDiceException):
212278
def __init__(self, *args, **kwargs):
213-
super(IndexEntityKeyTypeException, self).__init__(
279+
super(IndexInvalidDecimalPlacesException, self).__init__(
214280
self, *args, **kwargs)
215281

216282

@@ -244,9 +310,9 @@ def __init__(self, *args, **kwargs):
244310
self, *args, **kwargs)
245311

246312

247-
class IndexDateFormatException(SlicingDiceException):
313+
class IndexTimeSeriesDateFormatException(SlicingDiceException):
248314
def __init__(self, *args, **kwargs):
249-
super(IndexDateFormatException, self).__init__(
315+
super(IndexTimeSeriesDateFormatException, self).__init__(
250316
self, *args, **kwargs)
251317

252318

@@ -268,6 +334,12 @@ def __init__(self, *args, **kwargs):
268334
self, *args, **kwargs)
269335

270336

337+
class IndexDateFormatException(SlicingDiceException):
338+
def __init__(self, *args, **kwargs):
339+
super(IndexDateFormatException, self).__init__(
340+
self, *args, **kwargs)
341+
342+
271343
class IndexFieldStringEmptyValueException(SlicingDiceException):
272344
def __init__(self, *args, **kwargs):
273345
super(IndexFieldStringEmptyValueException, self).__init__(
@@ -310,6 +382,18 @@ def __init__(self, *args, **kwargs):
310382
self, *args, **kwargs)
311383

312384

385+
class QueryRelativeIntervalException(SlicingDiceException):
386+
def __init__(self, *args, **kwargs):
387+
super(QueryRelativeIntervalException, self).__init__(
388+
self, *args, **kwargs)
389+
390+
391+
class QueryDateFormatException(SlicingDiceException):
392+
def __init__(self, *args, **kwargs):
393+
super(QueryDateFormatException, self).__init__(
394+
self, *args, **kwargs)
395+
396+
313397
# Query errors
314398
class QueryMissingQueryException(SlicingDiceException):
315399
def __init__(self, *args, **kwargs):
@@ -365,9 +449,9 @@ def __init__(self, *args, **kwargs):
365449
self, *args, **kwargs)
366450

367451

368-
class QueryDateFormatException(SlicingDiceException):
452+
class QueryInvalidMetricException(SlicingDiceException):
369453
def __init__(self, *args, **kwargs):
370-
super(QueryDateFormatException, self).__init__(
454+
super(QueryInvalidMetricException, self).__init__(
371455
self, *args, **kwargs)
372456

373457

@@ -565,7 +649,43 @@ def __init__(self, *args, **kwargs):
565649

566650
class QueryCountInvalidParameterErrorException(SlicingDiceException):
567651
def __init__(self, *args, **kwargs):
568-
super(QueryLevelLimitException, self).__init__(
652+
super(QueryCountInvalidParameterErrorException, self).__init__(
653+
self, *args, **kwargs)
654+
655+
656+
class QueryInvalidMinfreqException(SlicingDiceException):
657+
def __init__(self, *args, **kwargs):
658+
super(QueryInvalidMinfreqException, self).__init__(
659+
self, *args, **kwargs)
660+
661+
662+
class QueryExceededMaxNumberQuerysException(SlicingDiceException):
663+
def __init__(self, *args, **kwargs):
664+
super(QueryExceededMaxNumberQuerysException, self).__init__(
665+
self, *args, **kwargs)
666+
667+
668+
class QueryInvalidOperatorUsageException(SlicingDiceException):
669+
def __init__(self, *args, **kwargs):
670+
super(QueryInvalidOperatorUsageException, self).__init__(
671+
self, *args, **kwargs)
672+
673+
674+
class QueryInvalidParameterUsageException(SlicingDiceException):
675+
def __init__(self, *args, **kwargs):
676+
super(QueryInvalidParameterUsageException, self).__init__(
677+
self, *args, **kwargs)
678+
679+
680+
class QueryParameterInvalidFieldUsageException(SlicingDiceException):
681+
def __init__(self, *args, **kwargs):
682+
super(QueryParameterInvalidFieldUsageException, self).__init__(
683+
self, *args, **kwargs)
684+
685+
686+
class QueryInvalidFieldUsageException(SlicingDiceException):
687+
def __init__(self, *args, **kwargs):
688+
super(QueryInvalidFieldUsageException, self).__init__(
569689
self, *args, **kwargs)
570690

571691

0 commit comments

Comments
 (0)