atk-common 1.18.0__py3-none-any.whl → 1.19.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- atk_common/error_utils.py +9 -9
- {atk_common-1.18.0.dist-info → atk_common-1.19.0.dist-info}/METADATA +1 -1
- {atk_common-1.18.0.dist-info → atk_common-1.19.0.dist-info}/RECORD +6 -6
- {atk_common-1.18.0.dist-info → atk_common-1.19.0.dist-info}/WHEEL +0 -0
- {atk_common-1.18.0.dist-info → atk_common-1.19.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.18.0.dist-info → atk_common-1.19.0.dist-info}/top_level.txt +0 -0
atk_common/error_utils.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
from http import HTTPStatus
|
2
|
+
from flask import Response
|
2
3
|
from datetime import datetime
|
4
|
+
from enum import Enum
|
3
5
|
import json
|
4
6
|
from atk_common.datetime_utils import get_utc_date_time
|
5
7
|
from atk_common.enums.api_error_type_enum import ApiErrorType
|
@@ -25,23 +27,21 @@ def create_error_log(data):
|
|
25
27
|
err_str += ', containerName: <none>'
|
26
28
|
add_log_item(err_str)
|
27
29
|
|
28
|
-
def get_error_entity(
|
30
|
+
def get_error_entity(error, method, error_type, status_code, container_info):
|
29
31
|
data = {}
|
30
32
|
data['statusCode'] = status_code
|
31
33
|
data['exceptionType'] = str(type(error))
|
32
|
-
data['errorType'] = error_type
|
34
|
+
data['errorType'] = error_type.value if isinstance(error_type, Enum) else error_type
|
33
35
|
data['message'] = get_message(error)
|
34
36
|
data['method'] = method
|
35
37
|
data['timestamp'] = get_utc_date_time()
|
36
38
|
data['containerInfo'] = container_info
|
37
39
|
create_error_log(data)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
)
|
44
|
-
return None
|
40
|
+
return Response(
|
41
|
+
response=json.dumps(data),
|
42
|
+
status=HTTPStatus.INTERNAL_SERVER_ERROR,
|
43
|
+
mimetype='application/json'
|
44
|
+
)
|
45
45
|
|
46
46
|
def handle_error(resp, status):
|
47
47
|
if is_http_status_internal(resp.status_code):
|
@@ -3,7 +3,7 @@ atk_common/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,
|
|
3
3
|
atk_common/db_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
atk_common/docker_utils.py,sha256=nkUhp2OhwJsm41JDujHDY-JxQfdDjy91duprH59Esfk,2084
|
5
5
|
atk_common/env_utils.py,sha256=66v-S0vlkJNaun6ay1XcOGRtYJb4Ce4odJsWxuaHsQc,373
|
6
|
-
atk_common/error_utils.py,sha256=
|
6
|
+
atk_common/error_utils.py,sha256=7SN-Jz3i2MGIPqsexnjgbZg5poMnALLEiCJQ4za5im4,2398
|
7
7
|
atk_common/http_utils.py,sha256=M1Qz2Cus3Ek8nUOqraT-30GKSj7nkAvJx2f7rnpX5Pk,656
|
8
8
|
atk_common/log_utils.py,sha256=k7VaknmSGvHQV6-eznltNUa3BOAywjFHkhVzDT1P0Hs,496
|
9
9
|
atk_common/mq_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -15,7 +15,7 @@ atk_common/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6
|
|
15
15
|
atk_common/enums/http_status_enum.py,sha256=bJSTmkLxHnb04fWSDKuhTWrh_v9iCQM7otAVr731JDk,139
|
16
16
|
atk_common/enums/response_status_enum.py,sha256=ogYXlGm0gJJDGlY6Fwq9Kvl861aGPop2qzfXXExzMKw,99
|
17
17
|
atk_common/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
18
|
-
atk_common-1.
|
18
|
+
atk_common-1.19.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
19
19
|
atk_package/__init__.py,sha256=EceDa352WFHTdC_LxYANXf_TS9pGzK3MCx87bwAKTvg,811
|
20
20
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
21
21
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -28,7 +28,7 @@ atk_package/enums/__init__.py,sha256=oW0aVnwewfH6sNu14jjZ5_uP4iRN4pRmGdTNC204rHo
|
|
28
28
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
29
29
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
30
30
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
|
-
atk_common-1.
|
32
|
-
atk_common-1.
|
33
|
-
atk_common-1.
|
34
|
-
atk_common-1.
|
31
|
+
atk_common-1.19.0.dist-info/METADATA,sha256=ROsazY251vJOFE4yUPZdvHrnGb-AFAw35hCYc8EQbkM,1464
|
32
|
+
atk_common-1.19.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
33
|
+
atk_common-1.19.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
34
|
+
atk_common-1.19.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|