protected function getFailResponse(Request $request, Exception $exception)
{
if ($request->isMethod(Request::METHOD_GET)) {
throw $exception;
}
return new Response(json_encode(['result' => 'ko', 'code' => $exception->getCode(), 'message' => $exception->getMessage()]));
}