diff --git a/airbyte-cdk/python/airbyte_cdk/sources/streams/http/error_handlers/json_error_message_parser.py b/airbyte-cdk/python/airbyte_cdk/sources/streams/http/error_handlers/json_error_message_parser.py index 0efc596aaa09..225fce2364db 100644 --- a/airbyte-cdk/python/airbyte_cdk/sources/streams/http/error_handlers/json_error_message_parser.py +++ b/airbyte-cdk/python/airbyte_cdk/sources/streams/http/error_handlers/json_error_message_parser.py @@ -5,10 +5,9 @@ from typing import Optional import requests +from airbyte_cdk.sources.streams.http.error_handlers import ErrorMessageParser from airbyte_cdk.sources.utils.types import JsonType -from .error_message_parser import ErrorMessageParser - class JsonErrorMessageParser(ErrorMessageParser): def _try_get_error(self, value: Optional[JsonType]) -> Optional[str]: @@ -26,6 +25,11 @@ def _try_get_error(self, value: Optional[JsonType]) -> Optional[str]: or value.get("failures") or value.get("failure") or value.get("detail") + or value.get("err") + or value.get("error_message") + or value.get("msg") + or value.get("reason") + or value.get("status_message") ) return self._try_get_error(new_value) return None diff --git a/airbyte-cdk/python/unit_tests/sources/streams/http/error_handlers/test_json_error_message_parser.py b/airbyte-cdk/python/unit_tests/sources/streams/http/error_handlers/test_json_error_message_parser.py index b8ef0fd5b4e7..81f838170341 100644 --- a/airbyte-cdk/python/unit_tests/sources/streams/http/error_handlers/test_json_error_message_parser.py +++ b/airbyte-cdk/python/unit_tests/sources/streams/http/error_handlers/test_json_error_message_parser.py @@ -13,6 +13,16 @@ (b'{"message": "json error message"}', "json error message"), (b'[{"message": "list error message"}]', "list error message"), (b'[{"message": "list error message 1"}, {"message": "list error message 2"}]', "list error message 1, list error message 2"), + (b'{"error": "messages error message"}', "messages error message"), + (b'[{"errors": "list error message 1"}, {"errors": "list error message 2"}]', "list error message 1, list error message 2"), + (b'{"failures": "failures error message"}', "failures error message"), + (b'{"failure": "failure error message"}', "failure error message"), + (b'{"detail": "detail error message"}', "detail error message"), + (b'{"err": "err error message"}', "err error message"), + (b'{"error_message": "error_message error message"}', "error_message error message"), + (b'{"msg": "msg error message"}', "msg error message"), + (b'{"reason": "reason error message"}', "reason error message"), + (b'{"status_message": "status_message error message"}', "status_message error message"), ] )