Skip to content

Commit

Permalink
throw catchable exception instead of exit in JSON response (#46)
Browse files Browse the repository at this point in the history
throw catchable exception instead of exit in JSON response
  • Loading branch information
David Lochner authored and simonschaufi committed Aug 3, 2019
1 parent 29b2006 commit 58eb15d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Response/JSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ public function parse($data, array $headers)
$headers['Status'] === 422 ||
$headers['Status'] === 400
)) {
print_r($headers);
exit;
throw new Exception([
'Message' => $errors,
'Response' => $data,
'Headers' => $headers
]);
}
if ($headers['Status'] === 201 || $headers['Status'] === 200) {
switch ($headers['Method']) {
Expand Down

0 comments on commit 58eb15d

Please sign in to comment.