Skip to content

Commit

Permalink
SP-874 Support "errors" array - format
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarzybok-sumoheavy committed Feb 26, 2024
1 parent 9ec690b commit 1d366b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/bitpay/clients/response_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ def response_to_json_string(response: Response) -> Any:
if "errors" in response_obj:
final_message = ""
for error in response_obj["errors"]:
error_value = error.get('error', '')
param_value = error.get('param', '')
error_value = error.get("error", "")
param_value = error.get("param", "")

if error_value.endswith('.'):
if error_value.endswith("."):
error_value = error_value[:-1]

if error_value:
result = f"{error_value} {param_value}".strip()
else:
result = param_value.strip()

if not result.endswith('.'):
result += '.'
if not result.endswith("."):
result += "."

if not final_message == "":
result = " " + result
Expand Down

0 comments on commit 1d366b0

Please sign in to comment.