src/PHPDish/Bundle/CoreBundle/EventListener/KernelExceptionListener.php
private function resolveStatusCode(\Exception $exception)
    {
        if ($exception instanceof HttpExceptionInterface) {
            $statusCode = $exception->getStatusCode();
        } else {
            if (in_array($exception->getCode(), array_keys(Response::$statusTexts))) {
                $statusCode = $exception->getCode();
            } else {
                $statusCode = static::DEFAULT_STATUS_CODE;
            }
        }

        return $statusCode;
    }
private function resolveStatusCode(\Exception $exception)
    {
        if ($exception instanceof HttpExceptionInterface) {
            $statusCode = $exception->getStatusCode();
        } else {
            if (in_array($exception->getCode(), array_keys(Response::$statusTexts))) {
                $statusCode = $exception->getCode();
            } else {
                $statusCode = static::DEFAULT_STATUS_CODE;
            }
        }

        return $statusCode;
    }
计算该异常对应的错误码

@param \Exception $exception

@return int