Construct a new FTP exception.

@param string $message The message.
@return FTPException Returns a new FTP exception.
776063
protected function newFTPException($message) {
        return new FTPException(sprintf("%s://%s:%s@%s:%d " . $message, $this->authenticator->getScheme(), $this->authenticator->getPasswordAuthentication()->getUsername(), $this->authenticator->getPasswordAuthentication()->getPassword(), $this->authenticator->getHost(), $this->authenticator->getPort()));
    }
556487
public static function makeFromException($e)
    {
        if ($e instanceof self) {
            return $e;
        }

        return new static($e->getMessage(), $e->getCode(), $e);
    }
241663
protected function isValidMessage($message): Message
    {
        if ($message instanceof Message) {
            return $message;
        }

        if (\is_string($message) || $message instanceof Attachment) {
            return Message::create($message);
        }

        throw new MessengerException(sprintf(
            'message must be a string or an instance of %s or %s.',
            Message::class,
            Attachment::class
        ));
    }
1250241
public function exception($message = 'Undefined Exception', $type = null, $code = null)
    {
        if ($type === null) {
            $type = $this->default_exception;
        } elseif ($type[0] == '_') {
            if ($this->default_exception == 'BaseException') {
                $type = 'Exception_'.substr($type, 1);
            } else {
                $type = $this->default_exception.'_'.substr($type, 1);
            }
        } elseif ($type != 'BaseException') {
            $type = $this->app->normalizeClassName($type, 'Exception');
        }

        // Localization support
        $message = $this->app->_($message);

        if ($type == 'Exception') {
            $type = 'BaseException';
        }

        $e = new $type($message, $code);
        if (!($e instanceof BaseException)) {
            throw $e;
        }
        $e->owner = $this;
        $e->app = $this->app;
        $e->api = $this->app; // compatibility with ATK 4.2 and lower
        $e->init();

        return $e;
    }
618875
public static function invalidMessage($message)
    {
        $type = is_object($message) ? get_class($message) : gettype($message);

        return new static('The message should be an instance of '.Message::class.". Given `{$type}` is invalid.", 1);
    }
491420
public static function send($message)
    {
        if (is_array($message)) {
            $message = new Message($message);
        }

        return static::getMailer()->send($message->getOriginal());
    }
529348
function setMessage($message)
    {
        if ($this->isAnonymous()) {
            throw new Pluf_Exception_DoesNotExist(__("User not exist, while you are trying to add message?!"));
        }
        $m = new User_Message();
        $m->account_id = $this;
        $m->message = $message;
        if (! $m->create()) {
            throw new Pluf_Exception(__("not possible to create a message"));
        }
        return $m;
    }
465735
public function parse(Message $message)
    {
        if (!isset($message->headers['Content-Type'])) {
            throw new Exceptions\Parser('Missing Content-Type header in message.');
        }

        $mediaTypeParts = explode(';', $message->headers['Content-Type']);
        $contentTypeParts = explode('+', $mediaTypeParts[0]);
        if (count($contentTypeParts) !== 2) {
            // TODO expose default format
            $contentTypeParts[1] = 'xml';
        }

        $media = $contentTypeParts[0];

        // add version if given
        if (count($mediaTypeParts) > 1) {
            $parameters = $this->parseParameters(implode(';', array_slice($mediaTypeParts, 1)));
            if (isset($parameters['version'])) {
                $media .= '; version=' . $parameters['version'];
            }
        }

        $format = $contentTypeParts[1];

        if (!isset($this->handlers[$format])) {
            throw new Exceptions\Parser("Unknown format specification: '{$format}'.");
        }

        $rawArray = $this->handlers[$format]->convert($message->body);

        // Only 1 XML root node
        $rootNodeArray = reset($rawArray);

        // @todo: This needs to be refactored in order to make the called URL
        // available to parsers in the server in a sane way
        if (isset($message->headers['Url'])) {
            $rootNodeArray['__url'] = $message->headers['Url'];
        }
        if (isset($message->headers['__publish'])) {
            $rootNodeArray['__publish'] = $message->headers['__publish'];
        }

        return $this->parsingDispatcher->parse($rootNodeArray, $media);
    }
298402
public static function UnkownException ($message, Exception $exception, $container = []) {
		return new static(self::FATAL, self::ID_FLYWHEEL, self::UNKOWN, 'Unkown:'. $message, $exception, null, null, $container);
	}
867509
public function throws(callable $fn, $exceptionType, $exceptionMessage = '', $message = '')
    {
        $this->assertion->setActual($fn);

        return $this->assertion->to->throw($exceptionType, $exceptionMessage, $message);
    }
1371407
final public function setErrorMessage($message)
    {
        $this->errorMessage = (string) $message;

        if (empty($this->errorMessage)) {
            throw new \RuntimeException('Error message cannot be empty !');
        }

        return $this;
    }
1040830
protected function createAccessDeniedException(string $message = 'Access Denied.', \Exception $previous = null): AccessDeniedException
    {
        if (!class_exists(AccessDeniedException::class)) {
            throw new \LogicException('You can not use the "createAccessDeniedException" method if the Security component is not available. Try running "composer require symfony/security-bundle".');
        }

        return new AccessDeniedException($message, $previous);
    }
599953
private function createAndDispatchTransportException($message, AnyException $exception)
    {
        $transportException = new Swift_TransportException($message, 0, $exception);

        if ($event = $this->eventDispatcher->createTransportExceptionEvent($this, $transportException)) {
            $this->eventDispatcher->dispatchEvent($event, 'exceptionThrown');
        }

        return $transportException;
    }
844875
public static function createOnException(ChannelInterface $channel, Delivery $delivery, Exception $previous)
    {
        return new self(
            sprintf(
                'An error has occurred during the notification process of message "%s" for channel "%s".'
                .' Exception : %s - %s',
                $delivery->getMessage(),
                get_class($channel),
                get_class($previous),
                $previous->getMessage()
            ),
            0,
            $previous
        );
    }
823269
public function getException($message)
    {
        // make exception based on the status code
        switch ($this->statusCode) {
            case 400:
                return
                    $message?
                        new PlivoValidationException($message):
                        new PlivoValidationException(
                            "A parameter is missing or ".
                            "is invalid while accessing resource");
                break;
            case 401:
                return
                    $message?
                        new PlivoAuthenticationException($message):
                        new PlivoAuthenticationException(
                        "Failed to authenticate while accessing resource");
                break;
            case 404:
                return
                    $message?
                        new PlivoNotFoundException($message):
                        new PlivoNotFoundException(
                        "Failed to authenticate while accessing resource");
                break;
            case 405:
                return
                    $message?
                        new PlivoRequestException($message):
                        new PlivoRequestException(
                        "HTTP method used is not allowed to access resource");
                break;
            case 500:
                return
                    $message?
                        new PlivoServerException($message):
                        new PlivoServerException(
                        "A server error occurred while accessing resource");
                break;
            default:
                return new PlivoRestException(json_encode($this->responseData));
        }

    }
206831
public static function decodeMessage(string $message): Message
    {
        $offset = 0;
        $header = self::decodeHeader($message, $offset);
        $messageObject = new Message($header);
        $messageObject->setQuestions(self::decodeResourceRecords($message, $header->getQuestionCount(), $offset, true));
        $messageObject->setAnswers(self::decodeResourceRecords($message, $header->getAnswerCount(), $offset));
        $messageObject->setAuthoritatives(self::decodeResourceRecords($message, $header->getNameServerCount(), $offset));
        $messageObject->setAdditionals(self::decodeResourceRecords($message, $header->getAdditionalRecordsCount(), $offset));

        return $messageObject;
    }
1271557
public static function fromException($e)
    {
        if (is_subclass_of($e, self::class)) {
            return $e;
        }
        return new self($e->message, $e->code);
    }