master

laravel/framework

Last updated at: 29/12/2023 09:24

ProcessTimedOutException.php

TLDR

This file defines the ProcessTimedOutException class, which extends the RuntimeException class. It also includes a constructor that accepts an instance of Symfony\Component\Process\Exception\ProcessTimedOutException and an instance of Illuminate\Contracts\Process\ProcessResult.

Classes

ProcessTimedOutException

The ProcessTimedOutException class is responsible for representing an exception that occurs when a process times out. It extends the RuntimeException class and includes a public property $result of type Illuminate\Contracts\Process\ProcessResult to store the process result.

Constructor

The class has a constructor that accepts two parameters: $original of type Symfony\Component\Process\Exception\ProcessTimedOutException and $result of type Illuminate\Contracts\Process\ProcessResult. This constructor initializes the $result property and calls the parent constructor of RuntimeException, passing the original exception's message, code, and the original exception instance.

<?php

namespace Illuminate\Process\Exceptions;

use Illuminate\Contracts\Process\ProcessResult;
use Symfony\Component\Process\Exception\ProcessTimedOutException as SymfonyTimeoutException;
use Symfony\Component\Process\Exception\RuntimeException;

class ProcessTimedOutException extends RuntimeException
{
    /**
     * The process result instance.
     *
     * @var \Illuminate\Contracts\Process\ProcessResult
     */
    public $result;

    /**
     * Create a new exception instance.
     *
     * @param  \Symfony\Component\Process\Exception\ProcessTimedOutException  $original
     * @param  \Illuminate\Contracts\Process\ProcessResult  $result
     * @return void
     */
    public function __construct(SymfonyTimeoutException $original, ProcessResult $result)
    {
        $this->result = $result;

        parent::__construct($original->getMessage(), $original->getCode(), $original);
    }
}