Return WP Error if this object does not contain necessary info to perform API requests.

@return null|WP_Error
164592
private function authenticationError()
    {
        if (empty($this->email) || empty($this->auth_key)) {
            return new WP_Error('authentication-error', 'Authentication information must be provided');
        }

        if (! is_email($this->email)) {
            return new WP_Error('authentication-error', 'Email is not valid');
        }

        return null;
    }
373019
public function validate_input( $post_array = null ) {
		! isset( $post_array ) and $post_array = $this->app->input->post();
		$errors = [];
		foreach ( $this->get_data_field_settings() as $k => $v ) {
			$param    = $this->get_post_field( $k, null, $post_array, $v );
			$param    = $this->sanitize_input( $param, $v['type'] );
			$validate = $this->validate( $param, $v );
			if ( $validate instanceof \WP_Error ) {
				$errors[ $k ][] = $validate->get_error_message();
			}
		}

		if ( $this->validate_post_title() && in_array( 'title', $this->get_post_type_supports() ) ) {
			if ( ! isset( $post_array['post_title'] ) || '' === trim( $post_array['post_title'] ) ) {
				$errors['post_title'][] = $this->app->translate( 'Value is required.' );
			}
		}

		return $this->filter_validate_input( $errors, $post_array );
	}
1049581
public function getError() {
        if ($this->error) {
            return $this->translate($this->error);
        }
        if ($this->form->model && is_object($this->form->model) && $this->form->model->hasErrors($this->name)) {
            $errors = $this->form->model->getErrors($this->name);
            foreach ($errors as &$message) {
                $message = $this->translate($message);
            }
            return $errors;
        }
        return null;
    }
1154270
public function get_error_message()
    {
        if ($this->is_valid()) {
            return null;
        }

        static $errors = [
            UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds the maximum upload size (limit is %s).',
            UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
            UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
            UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
            UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
            UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
            UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
        ];

        $message = 'The file "%s" was not uploaded due to an unknown error.';

        if (isset($errors[ $this->data['error'] ])) {
            $message = $errors[ $this->data['error'] ];
        }

        return \sprintf($message, $this->client_name, \size_format(\wp_max_upload_size()));
    }
1344355
protected function checkError()
	{
		if (isset($_GET[$this->errorParam])) {
			$error_code = $_GET[$this->errorParam];
			if ($error_code === $this->errorAccessDeniedCode) {
				// access_denied error (user canceled)
				$this->cancel();
			} else {
				$error = $error_code;
				if (isset($_GET[$this->errorDescriptionParam])) {
					$error = $_GET[$this->errorDescriptionParam] . ' (' . $error . ')';
				}
				throw new ErrorException($error);
			}
			return false;
		}

		return true;
	}
1336563
function ErrorMsg()
	{
		if (!$this->_connectionID) return "No connection established";
		$errmsg = '';

		try {
			$errc = $this->_connectionID->Errors;
			if (!$errc) return "No Errors object found";
			if ($errc->Count == 0) return '';
			$err = $errc->Item($errc->Count-1);
			$errmsg = $err->Description;
		}catch(exception $e) {
		}
		return $errmsg;
	}
695788
public function renderError()
	{
		$parent=$this->getParent();
		return $parent->getActiveFormWidget()->error($parent->getModel(), $this->name, $this->errorOptions, $this->enableAjaxValidation, $this->enableClientValidation);
	}
1347309
protected function buildErrorData()
    {
        if (is_null($this->errorCode)) {
            return null;
        }

        $data = [
            'code' => $this->errorCode,
            'message' => $this->message ?: $this->resolveMessage()
        ];

        return array_merge($data, $this->data);
    }
1320071
public function getError($key = null)
    {
        if (isset($key)) {
            return gplcart_array_get($this->errors, $key);
        }

        return $this->errors;
    }
1109507
public function getError()
    {
        $error = new Error($this->getMessage());
        $error->setValue($this->value);
        if ($this->field !== null) {
            $error->setName($this->field->getName());
        }
        if ($this->valueIndex !== null) {
            $error->setIndex($this->valueIndex);
        }
        return $error;
    }
1084661
public function hasError()
	{
		if( isset( $this->info['error'] ) )
			return ( empty( $this->info['error'] ) ? NULL : $this->info['error'] );
		else
			return NULL;
	}
649651
public function error()
	{
		// We need this because the error info is discarded by the
		// server the first time you request it, and query() already
		// calls error() once for logging purposes when a query fails.
		static $error = array('code' => 0, 'message' => NULL);

		$message = mssql_get_last_message();
		if ( ! empty($message))
		{
			$error['code']    = $this->query('SELECT @@ERROR AS code')->row()->code;
			$error['message'] = $message;
		}

		return $error;
	}
1194970
public function getErrorMessage()
    {
        $errorValue = null;
        if ($this->hasError()) {
            $errorValue = (string) $this->xmlElement->errors->error;
        }
        return $errorValue;
    }
199264
public function getErrorDescription()
    {
        if ($this->error === UPLOAD_ERR_OK) {
            return null;
        }
        
        $descs = static::ERROR_DESCRIPTIONS;
        return isset($descs[$this->error]) ? $descs[$this->error] : $descs[-1];
    }
813272
public function getMailError()
    {
        if ($this->_sMailError === null) {
            $this->_sMailError = false;
            $this->_sMailError = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('mailerror');
        }

        return $this->_sMailError;
    }
97431
public static function checkError()
    {
        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                $msg = null;
                break;
            case JSON_ERROR_DEPTH:
                $msg = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                $msg = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                $msg = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                $msg = 'Syntax error, malformed JSON';
                break;
            case JSON_ERROR_UTF8:
                $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
            default:
                $msg = 'Unknown error';
                break;
        }
        return $msg;
    }
876564
protected function get_error()
    {
        $query = $this->database->getQueryCollection()->findQuery($this->strQuery);

        if ($query) {
            return $query->error();
        }

        return '';
    }