@static

@param string $rbody
@param int    $rcode
@param array  $rheaders
@param array  $resp
@param array  $errorData

@return Error\RateLimit|Error\Idempotency|Error\InvalidRequest|Error\Authentication|Error\Card|Error\Permission|Error\Api
188661
private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData)
    {
        $msg = isset($errorData['message']) ? $errorData['message'] : null;
        $param = isset($errorData['param']) ? $errorData['param'] : null;
        $code = isset($errorData['code']) ? $errorData['code'] : null;
        $type = isset($errorData['type']) ? $errorData['type'] : null;

        switch ($rcode) {
            case 400:
                // 'rate_limit' code is deprecated, but left here for backwards compatibility
                // for API versions earlier than 2015-09-08
                if ($code == 'rate_limit') {
                    return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
                }
                if ($type == 'idempotency_error') {
                    return new Error\Idempotency($msg, $rcode, $rbody, $resp, $rheaders);
                }

                // intentional fall-through
            case 404:
                return new Error\InvalidRequest($msg, $param, $rcode, $rbody, $resp, $rheaders);
            case 401:
                return new Error\Authentication($msg, $rcode, $rbody, $resp, $rheaders);
            case 402:
                return new Error\Card($msg, $param, $code, $rcode, $rbody, $resp, $rheaders);
            case 403:
                return new Error\Permission($msg, $rcode, $rbody, $resp, $rheaders);
            case 429:
                return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
            default:
                return new Error\Api($msg, $rcode, $rbody, $resp, $rheaders);
        }
    }
1117416
function _errorHandler($errNo, $errMsg, $errFile, $errLine, $errCont)
    {
        $errType = $this->_getErrorTypes();

        $errorMessage = $errType[$errNo] . "\t\"" . trim($errMsg) . "\"\t" . $errFile . ' ' . 'Line:' . $errLine;

        if (self::$_config['errors']['logAll']) {
            error_log('JBDump:' . $errorMessage);
        }

        if (!(error_reporting() & $errNo) || error_reporting() == 0 || (int)ini_get('display_errors') == 0) {

            if (self::$_config['errors']['logHidden']) {
                $errorMessage = date(self::DATE_FORMAT, time()) . ' ' . $errorMessage . PHP_EOL;

                $logPath = self::$_config['log']['path']
                    . '/' . self::$_config['log']['file'] . '_error_' . date('Y.m.d') . '.log';

                error_log($errorMessage, 3, $logPath);
            }

            return false;
        }


        $errFile = $this->_getRalativePath($errFile);
        $result  = array(
            'file'    => $errFile . ' : ' . $errLine,
            'type'    => $errType[$errNo] . ' (' . $errNo . ')',
            'message' => $errMsg,
        );

        if (self::$_config['errors']['context']) {
            $result['context'] = $errCont;
        }

        if (self::$_config['errors']['errorBacktrace']) {
            $trace = debug_backtrace();
            unset($trace[0]);
            $result['backtrace'] = $this->convertTrace($trace);
        }

        if ($this->_isLiteMode()) {
            $errorInfo = array(
                'message' => $result['type'] . ' / ' . $result['message'],
                'file'    => $result['file']
            );
            $this->_dumpRenderLite($errorInfo, '* ' . $errType[$errNo]);

        } else {
            $desc = '<b style="color:red;">*</b> ' . $errType[$errNo] . ' / ' . $this->_htmlChars($result['message']);
            $this->dump($result, $desc);
        }

        return true;
    }
235265
def expect_invalid_resp_data(data=''):
    """"""
    try:
        yield
    except (ValueError, TypeError, IndexError, AttributeError,
            KeyError) as err:
        msg = ('Invalid smt response data: %s. Error: %s' %
               (data, six.text_type(err)))
        LOG.error(msg)
        raise exception.SDKInternalError(msg=msg)
1114173
public static function fromDict($rsp, $txnType, $returnType = 'HpsRefund')
    {
        $refund = parent::fromDict($rsp, $txnType, $returnType);
        $refund->responseCode = '00';
        $refund->responseText = '';
        return $refund;
    }
274226
public function phpErrorHandler($errno, $errstr, $errfile, $errline) {
		foreach($this->ignoreDirs as $dir) {
			if(strpos($errfile, $dir) === 0)
				return;
		}

		if($this->isLogging() && $this->logPHPErrors)
			$this->log(\Psr\Log\LogLevel::NOTICE, 'PHP ('.static::getPHPError($errno).'): '.$errstr, $errfile, $errline);
		throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
	}
421201
public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentCreateSession')
    {
        $createSession = $rsp->Transaction->$txnType;

        $session = parent::fromDict($rsp, $txnType, $returnType);
        if (isset($createSession->Session)) {
            $pairs = self::nvpToArray($createSession->Session);
        }

        $session->sessionId = isset($pairs['SessionId']) ? $pairs['SessionId'] : null;
        $session->redirectUrl = isset($pairs['RedirectUrl']) ? $pairs['RedirectUrl'] : null;

        return $session;
    }
494499
public function GetVDataString
	(
		$nErrorId,
		$sErrorDesc	= '',
		$arrVData	= [],
		$sVersion	= '1.0',
		$bCached	= null,
		$arrExtra	= []
	)
	{
		//
		//	nErrorId	- [in] int		error id
		//	sErrorDesc	- [in/opt] string	error description
		//	arrVData	- [in/opt] array	virtual data
		//	sVersion	- [in/opt] string	service version, default is '1.0'
		//	bCached		- [in/opt] bool		if the data come from cache
		//	arrExtra	- [in/opt] array	extra data by key-value pairs
		//	RETURN		- encoded json string
		//
		$sRet = '';

		//	...
		$arrJson = $this->GetVDataArray( $nErrorId, $sErrorDesc, $arrVData, $sVersion, $bCached, $arrExtra );
		if ( $this->IsValidVData( $arrJson ) )
		{
			$sRet = @ json_encode( $arrJson );
		}
		else
		{
			$sRet = @ json_encode( $this->GetDefaultVDataJson() );
		}

		return $sRet;
	}
1006516
function(err, r) {
      if (err) {
        numberOfValidConnections = numberOfValidConnections - 1;
        errorObject = err;
        return false;
      } else if (r.result['$err']) {
        errorObject = r.result;
        return false;
      } else if (r.result['errmsg']) {
        errorObject = r.result;
        return false;
      } else {
        numberOfValidConnections = numberOfValidConnections + 1;
      }

      return true;
    }
226345
public static function error_handler($errno, $errstr, $errfile, $errline)
    {
        self::flush(true);

        $response = PheryResponse::factory()->exception($errstr, array(
            'code' => $errno,
            'file' => self::$expose_paths ? $errfile : pathinfo($errfile, PATHINFO_BASENAME),
            'line' => $errline
        ));

        self::respond($response);
        self::shutdown_handler(false, true);
    }
644779
private static function prepareErrorMessage($validatorErrors, $data)
    {
        $errors = json_decode(json_encode($validatorErrors, true));
        array_walk($errors, function (&$value, $key) use ($data) {
            array_push($value, "Value: $data[$key]");
        });

        return json_encode($errors, true);
    }
809251
protected function response($respBody, $respHeaders, $respCode)
    {
        // Handle non successful HTTP status codes
        if ($respCode > 400) {
            $type = $respCode > 500 ? 'Internal error' : 'Request error';
            throw new GeneralException(
                'The request to NeverBounce was unsuccessful '
                . 'Try the request again, if this error persists'
                . ' let us know at support@neverbounce.com.'
                . "\n\n($type [status $respCode: $respBody])"
            );
        }

        // Check that the response type is expected
        $contentType = $respHeaders['content-type'];
        if ($this->acceptedType !== $contentType) {
            throw new GeneralException(
                'The request to NeverBounce was unsuccessful '
                . "Expected a response type of '{$this->acceptedType}' but "
                . "received a response type of '{$contentType}. "
                . 'Try the request again, if this error persists'
                . ' let us know at support@neverbounce.com.'
                . "\n\n(Unexpected Type [status $respCode: $respBody])"
            );
        }

        // Handle response based on Content-Type
        if ($this->acceptedType === 'application/json') {
            return $this->jsonResponse($respBody, $respCode);
        }

        return $this->decodedResponse = $respBody;
    }
481512
public function loadTypeDataByRemoteId($remoteId, $status)
    {
        try {
            return $this->innerGateway->loadTypeDataByRemoteId($remoteId, $status);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
40359
public static function fromDict($rsp, $txnType, $returnType = 'HpsAttachment')
    {
        $attResponse = $rsp->Transaction->$txnType->Details;
        $transaction = parent::fromDict($rsp, $txnType, $returnType);
        foreach (get_object_vars($attResponse) as $key => $prop) {
            if (property_exists($transaction, lcfirst($key))) {
                $transaction->__set(lcfirst($key), $prop);
            }
        }
        return $transaction;
    }
131420
public function triggerError($errorCode, $errorMessage = '')
    {
        $callError = $errorCode;

        if (!isset($this->error[$errorCode]) || !is_callable($this->error[$errorCode])) {
            if (isset($this->error[0]) && is_callable($this->error[0])) {
                $callError = 0;
            } else {
                // Nothing set to handle this error!
                return;
            }
        }

        // Error response function exists
        $this->match = true;

        //call_user_func_array($this->error[$errorCode], array($errorCode, $errorMessage));
        $this->error[$callError]($errorCode, $errorMessage);
        // Or use call_user_func_array ?

        exit($errorCode);
    }
880257
public static function fromDict($rsp, $txnType, $returnType = 'HpsOfflineAuthorization')
    {
        $offlineAuth = parent::fromDict($rsp, $txnType, $returnType);
        $offlineAuth->responseCode = '00';
        $offlineAuth->responseText = '';
        return $offlineAuth;
    }
1133100
protected function jump($errcode=null, $errmsg=null, $data=null)
    {
        $this->stop();
        
        $renderType = $this->getRenderType();
        
        $this->errorInfo  = ErrorInfo::instance($errcode, $errmsg, $data);
        
        if ($renderType === 'json') {
            return $this->renderJson($this->errorInfo);
        } else {
            return $this->renderMessageBox($this->errorInfo);
        }
    }
947856
public static function fromDict($rsp, $txnType, $returnType = 'HpsGiftCardActivate')
    {
        $activationRsp = $rsp->Transaction->$txnType;

        $activation = new $returnType();

        $activation->transactionId = (string)$rsp->Header->GatewayTxnId;
        $activation->authorizationCode = (isset($activationRsp->AuthCode) ? (string)$activationRsp->AuthCode : null);
        $activation->balanceAmount = (isset($activationRsp->BalanceAmt) ? (string)$activationRsp->BalanceAmt : null);
        $activation->pointsBalanceAmount = (isset($activationRsp->PointsBalanceAmt) ? (string)$activationRsp->PointsBalanceAmt : null);
        $activation->rewards = (isset($activationRsp->Rewards) ? (string)$activationRsp->Rewards : null);
        $activation->notes = (isset($activationRsp->Notes) ? (string)$activationRsp->Notes : null);
        $activation->responseCode = (isset($activationRsp->RspCode) ? (string)$activationRsp->RspCode : null);
        $activation->responseText = (isset($activationRsp->RspText) ? (string)$activationRsp->RspText : null);

        return $activation;
    }