Skip to content

Commit

Permalink
fix invalid reference to decode support id method
Browse files Browse the repository at this point in the history
  • Loading branch information
pnadolny13 committed Nov 8, 2024
1 parent 5f46ce3 commit b53031b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tap_intacct/sage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
SageIntacctSDKError,
WrongParamsError,
)
from tap_intacct.streams import IntacctStream


class PleaseTryAgainLaterError(Exception):
Expand Down Expand Up @@ -197,7 +198,7 @@ def _post_request(self, dict_body: dict, api_url: str) -> dict:
api_response = parsed_response["response"]["operation"]

if parsed_response["response"]["control"]["status"] == "failure":
exception_msg = self.decode_support_id(
exception_msg = IntacctStream.decode_support_id(
parsed_response["response"]["errormessage"]
)
raise WrongParamsError(
Expand Down
12 changes: 8 additions & 4 deletions tap_intacct/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ def prepare_request_payload(
}
return xmltodict.unparse(dict_body)

def _support_id_msg(self, errormessages: list | dict) -> list | dict:
@staticmethod
def support_id_msg(errormessages: list | dict) -> list | dict:
"""Get the support ID message from the error message."""
error = {}
if isinstance(errormessages["error"], list):
error["error"] = errormessages["error"][0]
Expand All @@ -329,8 +331,10 @@ def _support_id_msg(self, errormessages: list | dict) -> list | dict:

return error

def _decode_support_id(self, errormessages: list | dict) -> list | dict:
support_id_msg = self._support_id_msg(errormessages)
@staticmethod
def decode_support_id(errormessages: list | dict) -> list | dict:
"""Decode the support ID from the error message."""
support_id_msg = IntacctStream.support_id_msg(errormessages)
data_type = support_id_msg["type"]
error = support_id_msg["error"]
if error and error["description2"]:
Expand Down Expand Up @@ -381,7 +385,7 @@ def parse_response(self, response: requests.Response) -> t.Iterable[dict]:
api_response = parsed_response["response"]["operation"]

if parsed_response["response"]["control"]["status"] == "failure":
exception_msg = self._decode_support_id(
exception_msg = self.decode_support_id(
parsed_response["response"]["errormessage"]
)
raise WrongParamsError(
Expand Down

0 comments on commit b53031b

Please sign in to comment.