private getJsonException ( Exception $e ) : Symfony\Component\HttpFoundation\JsonResponse | ||
$e | Exception | |
return | Symfony\Component\HttpFoundation\JsonResponse |
private function getJsonException(\Exception $e)
{
// Make file path relative to not leak system info
$file = $e->getFile();
$base = realpath(__DIR__ . '/../../..');
$file = str_replace($base . '/', '', $file);
$error = ['error' => ['type' => get_class($e), 'file' => $file, 'line' => $e->getLine(), 'message' => $e->getMessage()]];
return new JsonResponse($error, Response::HTTP_INTERNAL_SERVER_ERROR);
}