Composes the exception message.

@param string        $command The executed command.
@param int           $status  The exit status of the executed command.
@param null|string[] $output  The output of the executed command.

@return string
495017
private function message(string $command, int $status, ?array $output): string
  {
    $message = sprintf('Command below exited with status %s:', $status);
    $message .= PHP_EOL;
    $message .= $command;

    if (!empty($output))
    {
      $message .= PHP_EOL;
      $message .= implode(PHP_EOL, $output);
    }

    return $message;
  }
103905
public function fire(Command $command)
    {
        if (! $this->finder->isFile('.env')) {
            throw new Exception('SocietyCMS is not installed. Please run "php artisan society:install" first.');
        }

        if ($command->option('refresh') && ! App::environment('demo')) {
            throw new Exception('Refresh option is only available in demo mode.');
        }

        if (! $command->option('force') && ! $command->option('refresh')) {
            if (! $command->confirm('Are you sure you want to start Demo Mode?')) {
                throw new Exception('Demo Mode cancelled');
            }
        }
    }
620978
public function quit($status) {
        if($this->died) {
            return;
        }
        $this->died = true;
        if($status) echo $status;
        throw new \Exception('die');
    }
466289
public function exec($command)
    {
        $result = @ftp_exec($this->connection, $command);
        
        if ($result === false) {
            throw new Exception('Unable to exec command');
        }

        return $this;
    }
1261440
public function stderr($msg, $status = self::STATUS_FAIL)
    {
        $msg = "<strong>".$msg."</strong>";
        $msg = $this->removeColors($msg);
        $msg = $this->replaceEOLs($msg);

        if (defined('STDERR')) {
            fwrite(STDERR, $msg);
        } else {
            echo $msg;
            if (count(\ob_get_status()) !== 0) {
                ob_flush();
            }
        }
        return $this;
    }
428310
public function handle(Input $input, Output $output)
    {
        $command = $input->getArgument('_command');

        try {
            if (!preg_match("/^[A-Z]\w*$/", $command)) throw new \Exception("Error: Invalid command name. It must be Characters and PascalCase.", 1);
            if (file_exists(app_path("Commands/{$command}.php"))) throw new \Exception("Error: The command name is already created.", 1);

            $output->writeln($this->makeTemplate($command) ?
                            "Successfully created." :
                            "File not created. Check the file path.");
        } catch (\Exception $e) {
            $output->writeln($e->getMessage());
        }
    }
1050034
protected function rsyncExec($command, $error_msg = 'Rsync has failed')
	{
		$this->log('execRSync: '. $command, LOG_DEBUG);

		chdir($this->basedir);

		passthru($command, $return);

		$this->log('');

		if ($return !== 0) {
			throw new DeployException($error_msg);
		}
	}
332856
public function execute()
    {
        $this->unixParams();
        $output = [];
        $return_var = 0;

        exec($this->the_command, $output, $return_var);

        if ($return_var !== 0) {
            throw new Exception(
                'Your report has an error and couldn\'t be processed! Try to output the command: '.
                escapeshellcmd($this->the_command),
                1
            );
        }

        return $output;
    }
515603
protected function getExceptionMessage(\Exception $exception, $statusCode = null)
    {
        $showMessage = $this->messagesMap->resolveException($exception);

        if ($showMessage || $this->debug) {
            return $exception->getMessage();
        }

        return array_key_exists($statusCode, Response::$statusTexts) ? Response::$statusTexts[$statusCode] : 'error';
    }
852770
protected function sendCommand(string $command) : string
    {
        try {
            $client = new Client;
            $client->addServer($this->config['sockets']['client']);
            $response = $client->sendCommand($command);
            $client->close();
            return $response;
        } catch (ClientException $e) {
            return 'error';
        }
    }
1317650
public function errorCommand(CommandException $exception)
    {
        $this->outputLine('<error>%s</error>', [$exception->getMessage()]);
        if ($exception instanceof AmbiguousCommandIdentifierException) {
            $this->outputLine('Please specify the complete command identifier. Matched commands:');
            $this->displayShortHelpForCommands($exception->getMatchingCommands());
        }
        $this->outputLine();
        $this->outputLine('Enter "%s help" for an overview of all available commands', [$this->getFlowInvocationString()]);
        $this->outputLine('or "%s help <commandIdentifier>" for a detailed description of the corresponding command.', [$this->getFlowInvocationString()]);
        $this->quit(1);
    }
351731
protected function writeFileResult($status, $message)
    {
        $output = null;

        if (0 === $this->outputLevel) {
           return null;
        }

        switch ($status) {
            case self::FILE_FAILURE:
                $output = $this->getFileResultTemplate('bg_red_fg_white', 'FAIL', 'file/test FAILURE', $message);
                break;

            case self::FILE_PASS:
                $output = $this->getFileResultTemplate('green', 'OK', 'file/test OK', $message);
                break;

            default: break;
        }

        $this->writeLine($output);
    }
700619
public static function onCommand($command, ConstraintViolationListInterface $violations)
    {
        $exception = new static(
            'Validation failed for ' . get_class($command) .
            ' with ' . $violations->count() . ' violation(s).'
        );

        $exception->command    = $command;
        $exception->violations = $violations;

        return $exception;
    }
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;
    }
151371
public static function liveExecute( $command, OutputInterface $output, $directory = null, $timeout = 120 ) {
		$directory = $directory !== null ? $directory : getcwd();

		$process = new Process( $command, null, null, null, $timeout );
		$process->setWorkingDirectory( $directory );
		$process->start();

		$process->wait( function( $type, $buffer ) use ( $output ) {
			$output->writeln( $buffer );
		} );

		if ( ! $process->isSuccessful() ) {
			throw new ProcessFailedException( $process );
		}

		return $process;
	}
14779
public function renderException($e, $output = null)
    {
        if ( ! $output) {
            $output = $this->output;

            if ($output instanceof ConsoleOutputInterface) {
                $output = $output->getErrorOutput();
            }
        }

        return parent::renderException($e, $output);
    }
129371
protected function execute($command)
    {
        $status = null;
        $result = array();
        exec($command, $result, $status);
        return !$status ? $result : null;
    }