I have a PHP file that extends the Exception class.
namespace App\CustomException;
class FileException extends Exception {
public function __construct($name) {
parent::construct($name);
}
}
I get a fatal error: Fatal error: Class 'App\CustomException\Exception on the line for the class that extends Exception.
I want to use a namespace for my custom exception messages so that I can import them easily in a another file, like use App\CustomException.
Why am I getting an error and how do I fix this? I don't get an error when I remove extend Exception, so I'm guessing this has something to do with the parent class.