check before get code
@param  string $send_to
@return \Wslim\Common\ErrorInfo
518651
public function check($send_to)
    {
        if (!DataHelper::verify_mobile($send_to) && !DataHelper::verify_email($send_to)) {
            return ErrorInfo::error('手机号或邮箱不正确');
        }
        
        // check if already send
        $sdata = static::getCache()->get($send_to);
        
        if ($sdata && $sdata['expire_time'] > (time() - $this->options['interval'])) {
            return ErrorInfo::error('信息已发送注意查收[1]');
        }
        
        return ErrorInfo::success();
    }
629577
private function _getMessage() {
		set_error_handler(array(
			$this,
			'_messageErrorHandler'
		), E_ALL);

		$args = func_get_args();
		if (isset($this->messages[$args[0]])) {
			$msg = $this->messages[$args[0]];

			try {
				array_shift($args);
				$formattedMsg = vsprintf($msg, $args);
			} catch (Exception $e) {
				$formattedMsg = $msg;
			}

			set_error_handler(array(
				$this,
				'customErrorHandler'
			), E_ALL);

			return $formattedMsg;
		}

		return FALSE;
	}
714151
public function getError( $_code ) {
		if ( isset( $this->errors[$_code] ) ) {
			return $this->errors[$_code];
		}
		else {
			return 'No such error code ' . $_code . '! Quit inventing errors!!!';
		}
	}
1004104
function delExpect($error_code)
    {
        $deleted = false;
        if ((is_array($error_code) && (0 != count($error_code)))) {
            // $error_code is a non-empty array here; we walk through it trying
            // to unset all values
            foreach ($error_code as $key => $error) {
                $deleted =  $this->_checkDelExpect($error) ? true : false;
            }

            return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
        } elseif (!empty($error_code)) {
            // $error_code comes alone, trying to unset it
            if ($this->_checkDelExpect($error_code)) {
                return true;
            }

            return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
        }

        // $error_code is empty
        return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
    }
346163
function ErrorMsg()
 	{
        if ($this->_errorMsg !== false) return $this->_errorMsg;

        if (is_resource($this->_curs)) $this->_errorMsg = @ora_error($this->_curs);
 		if (empty($this->_errorMsg)) $this->_errorMsg = @ora_error($this->_connectionID);
		return $this->_errorMsg;
	}
1065715
public static function translateErrorCode($error_code)
    {
        $constants = get_defined_constants(true);
        if (array_key_exists('Core', $constants)) {
            foreach ($constants['Core'] as $constant => $value) {
                if (substr($constant, 0, 2) == 'E_' && $value == $error_code) {
                    return $constant;
                }
            }
        }
        return "E_UNKNOWN";
    }
241922
public function send($to)
    {
        $this->message->setTo($to);
        $failers = [];
        $sent = $this->driver->send($this->message, $failers);
        return [$sent, $failers];
    }
986041
public function getErrors()
    {
        if (empty( $this->_errors )) {
            $errorList = Array();

            foreach ($this->__get(self::$ERROR) as $error) {
                $errorCode       = $error[self::$ERROR_ERROR_CODE];
                $message         = $error[self::$ERROR_MESSAGE];
                $consumerMessage = $error[self::$ERROR_CONSUMER_MESSAGE];
                $paySysMessage   = $error[self::$ERROR_PAY_SYS_MESSAGE];

                $errorObject = new WirecardCEE_QMore_Error($errorCode, $message);
                $errorObject->setPaySysMessage($paySysMessage);
                $errorObject->setConsumerMessage($consumerMessage);

                array_push($errorList, $errorObject);
            }

            $this->_errors = $errorList;
        }

        return $this->_errors;
    }
970930
private function _getErrorMessage($header_string) {
        list($status, $stash) = explode("\r\n", $header_string, 2);
        list($v, $code, $message) = explode(" ", $status, 3);
        return $message . " X-Request-Id: " . $this->getXRequestId();
    }
1055278
function ErrorMsg()
	{
		if (!function_exists('adodb_throw')) {
			if ($this->_dbat < 0) {
				$db = false;
			}
			else {
				$db = $this->DB();
			}

			// last error could be database error too
			if ($db && $db->ErrorMsg()) {
				return $db->ErrorMsg();
			}
		}
		return $this->_lasterr;
	}
976032
def check_err(resp, analyze_json_error_param=False, retry_request_substr_variants=None):
        
        if retry_request_substr_variants is None:
            retry_request_substr_variants = []

        # РКН блокировки вызывают ошибку SSL
        retry_request_substr_variants.append("TLSV1_ALERT_ACCESS_DENIED")

        if resp.status_code in [502, 503, 504]:
            raise RetryHttpRequestError(resp.text)

        if resp.status_code >= 400:
            rtext = resp.text
            for v_ in retry_request_substr_variants:
                if v_ in rtext:
                    raise RetryHttpRequestError(rtext)
            raise UnexpectedError("HTTP request failed: {} {}".format(resp.status_code, rtext))
        if analyze_json_error_param:
            data_ = resp.json()
            if 'error' in data_ and data_.get('error'):
                error = data_.get('error')
                full_err_ = json.dumps(error)

                if error.get("type") == "RateLimitError":
                    raise RateLimitError(error.get("message"), waiting_time=error.get("waiting_time"))

                for v_ in retry_request_substr_variants:
                    if v_ in full_err_:
                        raise RetryHttpRequestError(full_err_)
                raise ApiProxyError(full_err_)
        return resp
1202336
function ruleBefore($date, $error_message = null) {
        if (!strtotime($date)) {
            throw new \Exception('Incorrect date');
        }

        return $this->_rule('before:' . $date, $error_message);
    }
1226707
function _raiseError($id, $info = array())
    {
        $code = $this->errorCode[$id]['code'];
        $msg = $this->errorCode[$id]['msg'];

        // include info to messages
        if (!empty($info)) {
            $search = array();
            $replace = array();

            foreach ($info as $key => $value) {
                array_push($search, '{' . strtoupper($key) . '}');
                array_push($replace, $value);
            }

            $msg = str_replace($search, $replace, $msg);
        }

        return PEAR::raiseError($msg, $code);
    }
1244880
public function errorCode()
    {
        if (!$this->_stmt) {
            return false;
        }

        $error = oci_error($this->_stmt);

        if (!$error) {
            return false;
        }

        return $error['code'];
    }
1069976
public function PHPErrorHandler($error_level, $error_message, $error_file, $error_line, $error_context)
    {
        $message = $error_message . ' | File: {file} | Ln: {line}';
        $context = array(
            'file' => $error_file,
            'line' => $error_line
        );

        switch ($error_level) {
            case E_USER_ERROR:
                // no break
            case E_RECOVERABLE_ERROR:
                $this->logger->error($message, $context);
                break;
            case E_WARNING:
                // no break
            case E_USER_WARNING:
                $this->logger->warning($message, $context);
                break;
            case E_NOTICE:
                // no break
            case E_USER_NOTICE:
                $this->logger->notice($message, $context);
                break;
            case E_STRICT:
                $this->logger->debug($message, $context);
                break;
            default:
                $this->logger->warning($message, $context);
        }
        return;
    }
234424
public function checkValid()
    {
        // error code/message already set
        if ($this->error_code && $this->error_message) {
            return false;
        }

        // missing jsonrpc or method
        if (!$this->json_rpc || !$this->method) {
            $this->error_code = self::ERROR_INVALID_REQUEST;
            $this->error_message = "Invalid Request.";
            return false;
        }

        // reserved method prefix
        if (substr($this->method,0,4) == 'rpc.') {
            $this->error_code = self::ERROR_RESERVED_PREFIX;
            $this->error_message = "Illegal method name; Method cannot start with 'rpc.'";
            return false;
        }

        // illegal method name
        if (!preg_match(self::VALID_FUNCTION_NAME, $this->method)) {
            $this->error_code = self::ERROR_INVALID_REQUEST;
            $this->error_message = "Invalid Request.";
            return false;
        }

        // mismatched json-rpc version
        if ($this->json_rpc != "2.0") {
            $this->error_code = self::ERROR_MISMATCHED_VERSION;
            $this->error_message = "Client/Server JSON-RPC version mismatch; Expected '2.0'";
            return false;
        }

        // valid request
        return true;
    }
762094
public function get_errors_array($convert_to_string = false) {
        if (empty($this->errors)) {
            return ($convert_to_string) ? null : array();
        }

        $resp = array();

        foreach ($this->errors as $e) {
            $field = ucwords(str_replace(array('_', '-'), chr(32), $e['field']));
            $param = $e['param'];

            // Let's fetch explicit field names if they exist
            if (array_key_exists($e['field'], self::$fields)) {
                $field = self::$fields[$e['field']];
            }

            switch ($e['rule']) {
                case 'mismatch' :
                    $resp[$field] = "There is no validation rule for $field";
                    break;
                case 'validate_required':
                    $resp[$field] = "The $field field is required";
                    break;
                case 'validate_valid_email':
                    $resp[$field] = "The $field field is required to be a valid email address";
                    break;
                case 'validate_max_len':
                    $resp[$field] = "The $field field needs to be $param or shorter in length";
                    break;
                case 'validate_min_len':
                    $resp[$field] = "The $field field needs to be $param or longer in length";
                    break;
                case 'validate_exact_len':
                    $resp[$field] = "The $field field needs to be exactly $param characters in length";
                    break;
                case 'validate_alpha':
                    $resp[$field] = "The $field field may only contain alpha characters(a-z)";
                    break;
                case 'validate_alpha_numeric':
                    $resp[$field] = "The $field field may only contain alpha-numeric characters";
                    break;
                case 'validate_alpha_dash':
                    $resp[$field] = "The $field field may only contain alpha characters &amp; dashes";
                    break;
                case 'validate_numeric':
                    $resp[$field] = "The $field field may only contain numeric characters";
                    break;
                case 'validate_integer':
                    $resp[$field] = "The $field field may only contain a numeric value";
                    break;
                case 'validate_boolean':
                    $resp[$field] = "The $field field may only contain a true or false value";
                    break;
                case 'validate_float':
                    $resp[$field] = "The $field field may only contain a float value";
                    break;
                case 'validate_valid_url':
                    $resp[$field] = "The $field field is required to be a valid URL";
                    break;
                case 'validate_url_exists':
                    $resp[$field] = "The $field URL does not exist";
                    break;
                case 'validate_valid_ip':
                    $resp[$field] = "The $field field needs to contain a valid IP address";
                    break;
                case 'validate_valid_cc':
                    $resp[$field] = "The $field field needs to contain a valid credit card number";
                    break;
                case 'validate_valid_name':
                    $resp[$field] = "The $field field needs to contain a valid human name";
                    break;
                case 'validate_contains':
                    $resp[$field] = "The $field field needs to contain one of these values: " . implode(', ', $param);
                    break;
                case 'validate_contains_list':
                    $resp[$field] = "The $field field needs to contain a value from its drop down list";
                    break;
                case 'validate_doesnt_contain_list':
                    $resp[$field] = "The $field field contains a value that is not accepted";
                    break;
                case 'validate_street_address':
                    $resp[$field] = "The $field field needs to be a valid street address";
                    break;
                case 'validate_date':
                    $resp[$field] = "The $field field needs to be a valid date";
                    break;
                case 'validate_min_numeric':
                    $resp[$field] = "The $field field needs to be a numeric value, equal to, or higher than $param";
                    break;
                case 'validate_max_numeric':
                    $resp[$field] = "The $field field needs to be a numeric value, equal to, or lower than $param";
                    break;
                case 'validate_min_age':
                    $resp[$field] = "The $field field needs to have an age greater than or equal to $param";
                    break;
                case 'validate_unique':
                    $resp[$field] = "The $field field needs to have unique value";
                    break;
                default:
                    $resp[$field] = "The $field field is invalid";
            }
        }

        return $resp;
    }