Skip to content

[airbyte-cdk] - Update JSON Error Message Parser to return additional error message fields or default to dict #44010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 28, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand All @@ -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
Expand Down
Loading