| 1 |
<?php |
| 2 |
/** |
| 3 |
* Exception thrown when a filesystem operation fails. |
| 4 |
* |
| 5 |
* @package SolidWP\Performance |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types=1 ); |
| 9 |
|
| 10 |
namespace SolidWP\Performance\Filesystem\Exceptions; |
| 11 |
|
| 12 |
use RuntimeException; |
| 13 |
use Throwable; |
| 14 |
|
| 15 |
/** |
| 16 |
* Exception thrown when a filesystem operation fails. |
| 17 |
* |
| 18 |
* @package SolidWP\Performance |
| 19 |
*/ |
| 20 |
final class IOException extends RuntimeException { |
| 21 |
|
| 22 |
/** |
| 23 |
* The file path. |
| 24 |
* |
| 25 |
* @var string|null |
| 26 |
*/ |
| 27 |
private ?string $path; |
| 28 |
|
| 29 |
/** |
| 30 |
* @param string $message The exception message. |
| 31 |
* @param int $code The error code. |
| 32 |
* @param Throwable|null $previous The previous exception interface. |
| 33 |
* @param string|null $path The file path. |
| 34 |
*/ |
| 35 |
public function __construct( string $message, int $code = 0, ?Throwable $previous = null, ?string $path = null ) { |
| 36 |
$this->path = $path; |
| 37 |
|
| 38 |
parent::__construct( $message, $code, $previous ); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Get the file path associated with exception. |
| 43 |
* |
| 44 |
* @return string|null |
| 45 |
*/ |
| 46 |
public function get_path(): ?string { |
| 47 |
return $this->path; |
| 48 |
} |
| 49 |
} |
| 50 |
|