Skip to content

Commit

Permalink
Updated error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Meezaan-ud-Din committed Apr 17, 2019
1 parent cca6cba commit ebf988c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/AlAdhanApi/Handler/AlAdhanHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@ public function __invoke(Request $request, Response $response, Exception $except
};

$r = [
'code' => $exception->getCode(),
'code' => 500,
'status' => 'Internal Server Error',
'data' => 'Something went wrong when the server tried to process this request. Sorry!'
];

$log = new Log();
$log->error('AlAdhan Exception Triggered.',
$errorJson = json_encode(
[
'code' => $exception->getCode(),
'message' => $exception->getMessage(),
'trace' => $exception->getTraceAsString()
]
]
);

$log->error('AlAdhan Exception Triggered: ' . $errorJson);

return $response->withJson($r, $exception->getCode());
}

Expand Down

0 comments on commit ebf988c

Please sign in to comment.