<?php
/**
 * Thrown when destination config validation fails.
 *
 * @package Backreload\Destinations
 */

namespace Backreload\Destinations;

if ( ! defined( 'ABSPATH' ) ) { exit; }

class ValidationException extends \RuntimeException {

	/** @var array<string,string> */
	private array $errors;

	/**
	 * @param array<string,string> $errors  Field -> message map.
	 */
	public function __construct( array $errors, string $message = 'Validation failed' ) {
		parent::__construct( $message );
		$this->errors = $errors;
	}

	/** @return array<string,string> */
	public function errors(): array {
		return $this->errors;
	}
}
