class FileValidationException

Same name in other branches
  1. 9 core/modules/file/src/Upload/FileValidationException.php \Drupal\file\Upload\FileValidationException
  2. 10 core/modules/file/src/Upload/FileValidationException.php \Drupal\file\Upload\FileValidationException

Provides an exception for upload validation errors.

Hierarchy

Expanded class hierarchy of FileValidationException

File

core/modules/file/src/Upload/FileValidationException.php, line 8

Namespace

Drupal\file\Upload
View source
class FileValidationException extends \RuntimeException {
    
    /**
     * The validation errors.
     *
     * @var array
     */
    protected $errors;
    
    /**
     * The file name.
     *
     * @var string
     */
    protected $fileName;
    
    /**
     * Constructs a new FileValidationException.
     *
     * @param string $message
     *   The message.
     * @param string $file_name
     *   The file name.
     * @param array $errors
     *   The validation errors.
     */
    public function __construct(string $message, string $file_name, array $errors) {
        parent::__construct($message, 0, NULL);
        $this->fileName = $file_name;
        $this->errors = $errors;
    }
    
    /**
     * Gets the file name.
     *
     * @return string
     *   The file name.
     */
    public function getFilename() : string {
        return $this->fileName;
    }
    
    /**
     * Gets the errors.
     *
     * @return array
     *   The errors.
     */
    public function getErrors() : array {
        return $this->errors;
    }

}

Members

Title Sort descending Modifiers Object type Summary
FileValidationException::$errors protected property The validation errors.
FileValidationException::$fileName protected property The file name.
FileValidationException::getErrors public function Gets the errors.
FileValidationException::getFilename public function Gets the file name.
FileValidationException::__construct public function Constructs a new FileValidationException.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.