Skip to content

Commit

Permalink
[UPD] delivery_deliverea: Update error message displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
dalonsofl committed Dec 10, 2024
1 parent 2e65847 commit ac96069
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions delivery_deliverea/models/deliverea_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,11 @@ def _check_error(self, res):
if isinstance(error, list):
error = error[0]
return_code = error.get("code")
message = error.get("message")
detail = error.get("detail", "")
if return_code:
raise UserError(
_("%(name)s: %(rcode)s %(message)s %(detail)s %(ccode)s")
% {
"name": _("Deliverea Error"),
"rcode": return_code,
"message": message,
"detail": " ".join(
["%s: %s" % (key, value) for key, value in detail.items()]
)
if detail and not isinstance(detail, str)
else detail or "",
"ccode": "\n{}: {} {}".format(
_("Carrier Error"),
error.get("carrierCode"),
error.get("carrierMessage"),
)
if error.get("carrierCode")
else "",
}
error.get("carrierMessage")
if error.get("carrierMessage")
else "Uncontrolled error, it is necessary to check the log"
)
else:
raise UserError(
Expand Down

0 comments on commit ac96069

Please sign in to comment.