Skip to content
This repository was archived by the owner on May 9, 2020. It is now read-only.

Commit 92460a3

Browse files
committed
Flip the logic around to make the default code path clearer.
1 parent c3cbeb8 commit 92460a3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

chef/api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,10 @@ def request(self, method, path, headers={}, data=None):
203203
except requests.ConnectionError as e:
204204
raise ChefServerError(e.message)
205205

206-
if response.ok:
207-
return response
208-
209-
raise ChefServerError.from_error(response.reason, code=response.status_code)
206+
if not response.ok:
207+
raise ChefServerError.from_error(response.reason, code=response.status_code)
210208

209+
return response
211210

212211
def api_request(self, method, path, headers={}, data=None):
213212
headers = dict((k.lower(), v) for k, v in six.iteritems(headers))

0 commit comments

Comments
 (0)