master

laravel/framework

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

SQLiteDatabaseDoesNotExistException.php

TLDR

The file SQLiteDatabaseDoesNotExistException.php is a part of the Illuminate\Database namespace and extends the InvalidArgumentException class. It defines a custom exception class SQLiteDatabaseDoesNotExistException that is thrown when a database file does not exist. The exception message includes the path to the database file.

Classes

SQLiteDatabaseDoesNotExistException

This class is a custom exception class that extends the InvalidArgumentException class. It is thrown when a database file does not exist. The class has the following attributes and methods:

Attributes

  • $path (string): The path to the database file.

Methods

  • __construct($path): The constructor method of the class. It takes a $path parameter representing the path to the database file. It calls the parent constructor with a formatted exception message that includes the provided path. It also assigns the provided path to the $path attribute.
<?php

namespace Illuminate\Database;

use InvalidArgumentException;

class SQLiteDatabaseDoesNotExistException extends InvalidArgumentException
{
    /**
     * The path to the database.
     *
     * @var string
     */
    public $path;

    /**
     * Create a new exception instance.
     *
     * @param  string  $path
     * @return void
     */
    public function __construct($path)
    {
        parent::__construct("Database file at path [{$path}] does not exist. Ensure this is an absolute path to the database.");

        $this->path = $path;
    }
}