Open cjmling opened 5 years ago
Instead of
if (!$result) {
return $this->response()->json([
'errors' => 'This is shown to user',
], 400);
}
we can do
if (!$result) {
throw new FootyRoom\Core\CoreException('This is shown to user');
}
basically CoreException(‘message’)
if you want user to see the error message instead of “Whooops…” and any other type of Exception(‘private message’)
if you want only developers to see the message but everyone else gets “Whoops…”
error handler should take care of json response if route was called with ajax
Instead of
we can do
throw new \Exception('Unable to create temporary ban');