isServerError() public method

Was there a server side error?
public isServerError ( ) : boolean
return boolean
 /**
  * {@inheritdoc}
  */
 public function getParameters()
 {
     $code = null;
     $codeType = null;
     $cacheable = null;
     if (null !== $this->response) {
         $code = sprintf('%d', $this->response->getStatusCode());
         $cacheable = $this->response->isCacheable() ? 'cacheable' : 'not_cacheable';
         if ($this->response->isInformational()) {
             $codeType = 'informational';
         } elseif ($this->response->isSuccessful()) {
             $codeType = 'successful';
         } elseif ($this->response->isRedirection()) {
             $codeType = 'redirection';
         } elseif ($this->response->isClientError()) {
             $codeType = 'client_error';
         } elseif ($this->response->isServerError()) {
             $codeType = 'server_error';
         } else {
             $codeType = 'other';
         }
     }
     return array('response_code' => $code, 'response_code_type' => $codeType, 'response_cacheable' => $cacheable);
 }
 public function testIsServerOrClientError()
 {
     $response = new Response('', 404);
     $this->assertTrue($response->isClientError());
     $this->assertFalse($response->isServerError());
     $response = new Response('', 500);
     $this->assertFalse($response->isClientError());
     $this->assertTrue($response->isServerError());
 }
 /**
  * @param Response $response
  *
  * @return bool
  */
 private function logResponse(Response $response) : bool
 {
     return $response->isClientError() || $response->isServerError();
 }
 /**
  * Transform an exception handler's response into a Response object.
  *
  * @param  mixed      $response
  * @param  \Exception $exception
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function makeResponse($response, Exception $exception)
 {
     if (!$response instanceof Response) {
         $response = new Response($response);
     }
     if (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) {
         if ($exception instanceof HttpExceptionInterface) {
             $response->setStatusCode($exception->getStatusCode());
             $response->headers->add($exception->getHeaders());
         } else {
             $response->setStatusCode(500);
         }
     }
     return $response;
 }
 public function assertUnsuccessfulResponse(Response $response)
 {
     $this->assertTrue($response->isClientError() || $response->isServerError());
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function check(Response $response, Request $request)
 {
     if ($response->isServerError()) {
         return static::DENY;
     }
 }