HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ubuntu-8gb-hel1-1 6.8.0-55-generic #57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025 x86_64
User: www-data (33)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /var/www/agighana.org_backup/Invalid_Datapoint_Exception.php
<?php
/**
 * Class Google\Site_Kit\Core\REST_API\Exception\Invalid_Datapoint_Exception
 *
 * @package   Google\Site_Kit\Core\REST_API\Exception
 * @copyright 2021 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

namespace Google\Site_Kit\Core\REST_API\Exception;

use Google\Site_Kit\Core\Contracts\WP_Errorable;
use Exception;
use WP_Error;

/**
 * Exception thrown when a request to an invalid datapoint is made.
 *
 * @since 1.9.0
 * @access private
 * @ignore
 */
class Invalid_Datapoint_Exception extends Exception implements WP_Errorable {

	const WP_ERROR_CODE = 'invalid_datapoint';

	/**
	 * Gets the WP_Error representation of this exception.
	 *
	 * @since 1.9.0
	 *
	 * @return WP_Error
	 */
	public function to_wp_error() {
		return new WP_Error(
			static::WP_ERROR_CODE,
			__( 'Invalid datapoint.', 'google-site-kit' ),
			array(
				'status' => 400, // Bad request.
			)
		);
	}
}