Skip to content

Commit

Permalink
simplify response success setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pramttl committed Jan 24, 2019
1 parent 00851d0 commit 4408c52
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions braze/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,14 @@ def __create_request(self, payload):
response["status_code"] = r.status_code

message = response["message"]
if message == "success" or message == "queued":
if not response["errors"]:
response["success"] = True
else:
# Non-Fatal errors
pass
response["success"] = (
message in ("success", "queued") and not response["errors"]
)

if message != "success":
# message contains the fatal error message from Braze
raise BrazeClientError(message, response["errors"])

if "success" not in response:
response["success"] = False

if "status_code" not in response:
response["status_code"] = 0

Expand Down

0 comments on commit 4408c52

Please sign in to comment.