From 58eb15dc0863842df26fe2eda7a6b31684b3a826 Mon Sep 17 00:00:00 2001 From: David Lochner Date: Sat, 3 Aug 2019 23:58:57 +0200 Subject: [PATCH] throw catchable exception instead of exit in JSON response (#46) throw catchable exception instead of exit in JSON response --- src/Response/JSON.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Response/JSON.php b/src/Response/JSON.php index 121400e..ee9ad18 100755 --- a/src/Response/JSON.php +++ b/src/Response/JSON.php @@ -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']) {