Skip to content

Commit 42cd52f

Browse files
author
derwentx
committed
clearer error message for duplicate email
1 parent d8dc917 commit 42cd52f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

wordpress/api.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ def request_post_mortem(self, response=None):
8888

8989
# import pudb; pudb.set_trace()
9090

91-
if 'code' in response_json or 'message' in response_json:
92-
reason = " - ".join([
93-
str(response_json.get(key)) for key in ['code', 'message', 'data'] \
94-
if key in response_json
95-
])
96-
9791
request_body = {}
9892
request_url = ""
9993
if hasattr(response, 'request'):
@@ -102,6 +96,16 @@ def request_post_mortem(self, response=None):
10296
if hasattr(response.request, 'body'):
10397
request_body = response.request.body
10498

99+
if 'code' in response_json or 'message' in response_json:
100+
reason = " - ".join([
101+
str(response_json.get(key)) for key in ['code', 'message', 'data'] \
102+
if key in response_json
103+
])
104+
105+
if 'code' == 'rest_user_invalid_email':
106+
remedy = "Try checking the email %s doesn't already exist" % \
107+
request_body.get('email')
108+
105109
response_headers = {}
106110
if hasattr(response, 'headers'):
107111
response_headers = response.headers

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy