[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/third-party/Http/Discovery/Exception/ -> DiscoveryFailedException.php (source)

   1  <?php
   2  
   3  namespace WordPress\AiClientDependencies\Http\Discovery\Exception;
   4  
   5  use WordPress\AiClientDependencies\Http\Discovery\Exception;
   6  /**
   7   * Thrown when all discovery strategies fails to find a resource.
   8   *
   9   * @author Tobias Nyholm <tobias.nyholm@gmail.com>
  10   */
  11  final class DiscoveryFailedException extends \Exception implements Exception
  12  {
  13      /**
  14       * @var \Exception[]
  15       */
  16      private $exceptions;
  17      /**
  18       * @param string       $message
  19       * @param \Exception[] $exceptions
  20       */
  21      public function __construct($message, array $exceptions = [])
  22      {
  23          $this->exceptions = $exceptions;
  24          parent::__construct($message);
  25      }
  26      /**
  27       * @param \Exception[] $exceptions
  28       */
  29      public static function create($exceptions)
  30      {
  31          $message = 'Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors';
  32          foreach ($exceptions as $e) {
  33              $message .= "\n - " . $e->getMessage();
  34          }
  35          $message .= "\n\n";
  36          return new self($message, $exceptions);
  37      }
  38      /**
  39       * @return \Exception[]
  40       */
  41      public function getExceptions()
  42      {
  43          return $this->exceptions;
  44      }
  45  }


Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref