Skip to content

Commit 58eb15d

Browse files
David Lochnersimonschaufi
David Lochner
authored andcommitted
throw catchable exception instead of exit in JSON response (#46)
throw catchable exception instead of exit in JSON response
1 parent 29b2006 commit 58eb15d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Response/JSON.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ public function parse($data, array $headers)
2929
$headers['Status'] === 422 ||
3030
$headers['Status'] === 400
3131
)) {
32-
print_r($headers);
33-
exit;
32+
throw new Exception([
33+
'Message' => $errors,
34+
'Response' => $data,
35+
'Headers' => $headers
36+
]);
3437
}
3538
if ($headers['Status'] === 201 || $headers['Status'] === 200) {
3639
switch ($headers['Method']) {

0 commit comments

Comments
 (0)