/** * Internal method that checks if the CLI call has succeeded and throws an Excetion otherwise * * @param CallResult $result The CLI result * @param string $message The exception message */ protected static function throwIfError(CallResult $result, $message) { if ($result->getReturnCode() > 0) { throw new CallException($message, $result); } }
/** * Creates a new exception * * @param string $message The exception message * @param CallResult $cliCallResult The call result that caused the exception */ public function __construct($message, CallResult $cliCallResult) { $this->cliCallResult = $cliCallResult; parent::__construct(sprintf($message . ' [%s]', $cliCallResult->getStdErr()), $cliCallResult->getReturnCode()); }