Creates an exception for a server name that was not found.

@param string         $serverName The server name.
@param Exception|null $cause      The exception that caused this
exception.

@return static The created exception.
1975
public static function serverNotFound($serverName, Exception $cause = null)
    {
        return new static(sprintf(
            'The asset server "%s" does not exist.',
            $serverName
        ), self::SERVER_NOT_FOUND, $cause);
    }
573342
final public static function exceptionHandler(\Throwable $exception)
    {
        if (FEnv::isset("framework.env")) {
            throw new Server500(new \ArrayObject(array("explain" => $exception->getMessage(),
                "trace" => $exception->getTrace(), "line_error" => $exception->getLine(),
                "file_error" => $exception->getFile(), "type_error" => self::errorMap($exception->getCode()))));
        } else {
            die($exception->getMessage());
        }
    }
1045070
public function initTrace($serverName, $agentHostPort = ''){

        if(self::$disabled){
            return NoopTracer::create();
        }

        if($serverName == ''){
            throw new \Exception("serverName require");
        }

        if(isset(self::$tracer[$serverName]) && !empty(self::$tracer[$serverName])){
            return self::$tracer[$serverName];
        }


        if($this->transport == null){
            $this->transport = new TransportUdp($agentHostPort);
        }

        if($this->reporter == null) {
            $this->reporter = new RemoteReporter($this->transport);
        }

        if($this->sampler == null){
            $this->sampler = new ConstSampler(true);
        }


        $tracer = new Jaeger($serverName, $this->reporter, $this->sampler);

        if($this->gen128bit == true){
            $tracer->gen128bit();
        }

        if(self::$propagator == \Jaeger\Constants\PROPAGATOR_ZIPKIN){
            $tracer->setPropagator(new ZipkinPropagator());
        }else{
            $tracer->setPropagator(new JaegerPropagator());
        }


        self::$tracer[$serverName] = $tracer;


        return $tracer;
    }
431392
public static RedisConnectionException create(SocketAddress remoteAddress, Throwable cause) {
        return create(remoteAddress == null ? null : remoteAddress.toString(), cause);
    }
1015626
static public function create(
        $httpStatus = Response::HTTP_INTERNAL_SERVER_ERROR,
        $message = '',
        \Exception $previous = null
    ) {
        return new static($httpStatus, $message, $previous);
    }
71866
public function setError($msg, Exception $cause = null)
    {
        if ($this->errmsg === null) {
            $this->errmsg = $msg;
            $this->cause = $cause;
        }
    }
1080565
protected function prepareException(Exception $e)
    {
        if ($e instanceof ModelNotFoundException) {
            $e = new NotFoundHttpException($e->getMessage(), $e);
        } else if ($e instanceof AuthorizationException) {
            $e = new HttpException(403, $e->getMessage());
        }

        return $e;
    }
952939
public static function forArgumentName($name, $code = 0, Exception $cause = null)
    {
        return new static(sprintf(
            'The argument "%s" does not exist.',
            $name
        ), $code, $cause);
    }
1067909
public function getJsonRpcResponseFromException(
        \Exception $exception,
        JsonRpcRequest $fromRequest = null
    ) : JsonRpcResponse {
        $event = new ActionEvent\OnExceptionEvent($exception, $fromRequest);
        $this->dispatchJsonRpcEvent($event::EVENT_NAME, $event);

        return $this->responseCreator->createErrorResponse($event->getException(), $fromRequest);
    }
974972
public static function makeFromException($e, $overrideCode = null)
    {
        $code = $overrideCode === null ? $e->getCode() : $overrideCode;

        if ($e instanceof static) {
            $e->code = $code;

            return $e;
        }

        return new static($e->getMessage(), $code, $e);
    }
66286
protected function determineException(ClientException $exception): Exception
    {
        if (in_array($exception->getResponse()->getStatusCode(), [400, 403, 404, 409])) {
            return new BadRequest($exception->getResponse());
        }

        return $exception;
    }
834637
public function create(string $name)
    {
        if ($this->locator->has($name)) {
            return $this->locator->get($name);
        }

        throw new \Exception(\sprintf('Filter "%s" was not found.', $name));
    }
418490
public static function createFromException(\Exception $e, $http_status = Response::STATUS_ERROR)
    {
        return new Error(
            $e->getMessage(),
            $http_status,
            $e->getFile(),
            $e->getLine(),
            $e
        );
    }
422552
public static function tryParse(string $hostname): ?HostnameInterface
    {
        if (!self::myParse($hostname, $domainParts, $tld)) {
            return null;
        }

        return new self($domainParts, $tld);
    }
310287
private function mapException(ControllerException $exception): ClientException
    {
        switch ($exception->getCode()) {
            case ControllerException::BAD_ACTION:
                //no break
            case ControllerException::NOT_FOUND:
                return new NotFoundException($exception->getMessage());
            case ControllerException::FORBIDDEN:
                return new ForbiddenException($exception->getMessage());
            default:
                return new BadRequestException($exception->getMessage());
        }
    }
1183982
public static function create(Request $request, Response $response, int $status, string $message = null): self
    {
        $exception = new self($message ?? self::getMessageByStatus($status), $status);

        $exception->request = $request;
        $exception->response = $response;
        $exception->hasDefaultMessage = null === $message;

        return $exception;
    }
195004
public function create($serverIdentifier) {
		if (!isset($this->serverConfigurations[$serverIdentifier]) || !is_array($this->serverConfigurations[$serverIdentifier])) {
			throw new Exception('Invalid configuration for server "' . $serverIdentifier . '" in Flowpack.SingleSignOn.Client.server', 1351688340);
		}
		$serverConfiguration = $this->serverConfigurations[$serverIdentifier];
		$ssoServer = new \Flowpack\SingleSignOn\Client\Domain\Model\SsoServer();
		if (!isset($serverConfiguration['serviceBaseUri']) || (string)$serverConfiguration['serviceBaseUri'] === '') {
			throw new Exception('Missing serviceBaseUri setting in Flowpack.SingleSignOn.Client.server.' . $serverIdentifier, 1352719244);
		}
		$serverConfiguration['serviceBaseUri'] = rtrim($serverConfiguration['serviceBaseUri'], '/');
		$ssoServer->setServiceBaseUri($serverConfiguration['serviceBaseUri']);
		$ssoServer->setEndpointUri($serverConfiguration['serviceBaseUri'] . '/authentication');

		if (!isset($serverConfiguration['publicKeyFingerprint']) || (string)$serverConfiguration['publicKeyFingerprint'] === '') {
			throw new Exception('Missing publicKeyFingerprint setting for Flowpack.SingleSignOn.Client.server.' . $serverIdentifier, 1351688420);
		}
		$ssoServer->setPublicKey($serverConfiguration['publicKeyFingerprint']);
		if (!isset($serverConfiguration['publicKeyFingerprint']) || (string)$serverConfiguration['publicKeyFingerprint'] === '') {
			throw new Exception('Missing publicKeyFingerprint setting for Flowpack.SingleSignOn.Client.server.' . $serverIdentifier, 1351688420);
		}

		// TODO Set service base URI
		return $ssoServer;
	}