# subscription/1.3.1/includes/Traits/Form_Error.php

Subscriptions for WooCommerce with Stripe Recurring Payments, version 1.3.1. 44 lines.

- Page: https://pluginprobe.com/plugins/subscription/1.3.1/code/includes/Traits/Form_Error.php
- Raw: https://pluginprobe.com/plugins/subscription/1.3.1/raw/includes/Traits/Form_Error.php
- Modified: 2022-04-11T22:30:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/subscription/1.3.1/code/includes/Traits/Form_Error.php#L10-L20`.

```php
<?php

namespace SpringDevs\Subscription\Traits;

/**
 * Error handler trait
 */
trait Form_Error {


	/**
	 * Holds the errors
	 *
	 * @var array
	 */
	public $errors = array();

	/**
	 * Check if the form has error
	 *
	 * @param  string $key
	 *
	 * @return boolean
	 */
	public function has_error( $key ) {
		return isset( $this->errors[ $key ] ) ? true : false;
	}

	/**
	 * Get the error by key
	 *
	 * @param  key $key
	 *
	 * @return string | false
	 */
	public function get_error( $key ) {
		if ( isset( $this->errors[ $key ] ) ) {
			return $this->errors[ $key ];
		}

		return false;
	}
}

```
