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 Nov 28, 2024
1 parent 2e65847 commit 801cb5b
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions delivery_deliverea/models/deliverea_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,14 @@ 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 "",
}
_("%s")
% (
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 801cb5b

Please sign in to comment.