WC_REST_WCCOM_Site_Installer_Error{}WC 1.0

WCCOM Site Installer Error Class

No Hooks.

Usage

$WC_REST_WCCOM_Site_Installer_Error = new WC_REST_WCCOM_Site_Installer_Error();
// use class methods

Methods

  1. public __construct( $error_code, $error_message = null, $http_code = null )
  2. public get_error_code()
  3. public get_error_message()
  4. public get_http_code()

WC_REST_WCCOM_Site_Installer_Error{} code WC 8.7.0

class WC_REST_WCCOM_Site_Installer_Error extends Exception {

	/**
	 * Constructor for the Installer Error class.
	 *
	 * @param string $error_code Error code.
	 * @param string $error_message Error message.
	 * @param int    $http_code HTTP status code.
	 */
	public function __construct( $error_code, $error_message = null, $http_code = null ) {
		$this->error_code    = $error_code;
		$this->error_message = $error_message ?? WC_REST_WCCOM_Site_Installer_Error_Codes::ERROR_MESSAGES[ $error_code ] ?? '';
		$this->http_code     = $http_code ?? WC_REST_WCCOM_Site_Installer_Error_Codes::HTTP_CODES[ $error_code ] ?? 400;

		parent::__construct( $error_code );
	}

	/**
	 * Get the error code.
	 */
	public function get_error_code() {
		return $this->error_code;
	}

	/**
	 * Get the error message.
	 */
	public function get_error_message() {
		return $this->error_message;
	}

	/**
	 * Get the HTTP status code.
	 */
	public function get_http_code() {
		return $this->http_code;
	}
}