If we have an exception, return
@return array|bool
431879
private function getFallbackCountry() {

		if ( empty( $this->opts['fallback_country'] ) ) {
			$this->opts['fallback_country'] = 'US';
		}
		$record = (object) [
			'continent'   => new \StdClass(),
			'country'     => new \StdClass(),
			'state'       => new \StdClass(),
			'city'        => new \StdClass(),
			'geolocation' => new \StdClass(),
		];
		// debug page return empty
		if ( isset( $_GET['page'] ) && 'geot-debug-data' == $_GET['page'] ) {
			return new GeotRecord( $record );
		}

		$record->country = $this->getCountryByIsoCode( $this->opts['fallback_country'] );

		$this->user_data[ $this->cache_key ] = new GeotRecord( $record );

		return $this->user_data[ $this->cache_key ];

	}
1037834
public static function reset() {
		static::$_config = [];
		static::$_checks = [];
		static::$_exceptionHandler = null;
		static::$_checks = [
			'type'  => function($config, $info) {
				return (boolean) array_filter((array) $config['type'], function($type) use ($info) {
					return $type === $info['type'] || is_subclass_of($info['type'], $type);
				});
			},
			'code' => function($config, $info) {
				return ($config['code'] & $info['code']);
			},
			'stack' => function($config, $info) {
				return (boolean) array_intersect((array) $config['stack'], $info['stack']);
			},
			'message' => function($config, $info) {
				return preg_match($config['message'], $info['message']);
			}
		];
		static::$_exceptionHandler = function($exception, $return = false) {
			if (ob_get_length()) {
				ob_end_clean();
			}
			$info = compact('exception') + [
				'type' => get_class($exception),
				'stack' => static::trace($exception->getTrace())
			];
			foreach (['message', 'file', 'line', 'trace'] as $key) {
				$method = 'get' . ucfirst($key);
				$info[$key] = $exception->{$method}();
			}
			return $return ? $info : static::handle($info);
		};
	}
1145039
public static function _matchException($actual, $exception)
    {
        if (!$actual) {
            return false;
        }
        if ($exception instanceof AnyException) {
            $code = $exception->getCode() ? $actual->getCode() : $exception->getCode();
            $class = get_class($actual);
        } else {
            $code = $actual->getCode();
            $class = get_class($exception);
        }

        if (get_class($actual) !== $class) {
            return false;
        }

        $sameCode = $code === $exception->getCode();
        $sameMessage = static::_sameMessage($actual->getMessage(), $exception->getMessage());
        return $sameCode && $sameMessage;
    }
1314805
public function processException($exception)
    {
        $requestDetails = [
            'type' => 'exception',
            'data' => json_encode([
                'exception_content' => $exception->getMessage() ?? 'No message',
                'exception_trace' => $exception->getTrace(),
                'exception_file' => $exception->getFile(),
                'exception_line' => $exception->getLine(),
            ]),
        ];

        return array_merge($this->baseRequest(), $requestDetails);
    }
559503
public function hasErrors() {
    foreach ($this->jsonArray as $error) {
      if ($error['type'] != self::OK)
        return TRUE;
    }
    return FALSE;
  }
457268
public function validate()
    {
        // If there are no validators in the array then the validation is "successfull"
        if (!count($this->_validators)) {
            return true;
        }

        $_bValid = true;

        // Iterate thru all the validators and validate every one of them
        foreach ($this->_validators as $param => $aValidator) {
            foreach ($aValidator as $oValidator) {
                /** @var WirecardCEE_Stdlib_Validate_ValidateAbstract $oValidator */
                $param = (string) $param;

                if (!isset( $this->_returnData[$param] )) {
                    throw new Exception(sprintf("No key '{$param}' found in \$this->_returnData array. Thrown in %s on line %s.",
                        __METHOD__, __LINE__));
                }

                $bValidatorResult = $oValidator->isValid($this->_returnData[$param], $this->_returnData);

                $_bValid = $_bValid && $bValidatorResult;
            }
        }

        return (bool) $_bValid;
    }
341782
public function check()
    {
        $response = Director::test($this->url);

        if ($response->getStatusCode() != 200) {
            return [
                EnvironmentCheck::ERROR,
                sprintf('Error retrieving "%s" (Code: %d)', $this->url, $response->getStatusCode())
            ];
        } elseif ($this->testString && (strpos($response->getBody(), $this->testString) === false)) {
            return [
                EnvironmentCheck::WARNING,
                sprintf('Success retrieving "%s", but string "%s" not found', $this->url, $this->testString)
            ];
        }
        return [
            EnvironmentCheck::OK,
            sprintf('Success retrieving "%s"', $this->url)
        ];
    }
87574
public function checkUpdatesSettings()
    {
        $ret = true;
        foreach ($this->_updates as $update) {
            $e = false;
            try {
                $update->checkSettings();
            } catch (Exception $e) {
                throw $e; //no special handling for now, maybe something better should be done
                $ret = false;
            }
        }
        return $ret;
    }
1215175
protected function isActive(): bool
    {
        if ($this->currentErrorException !== null) {
            return true;
        }

        // ugly, but there is no get_error_handler()
        $currentErrorHandler = set_error_handler(function () {});
        restore_error_handler();

        return is_array($currentErrorHandler) && $currentErrorHandler[0] === $this;
    }
71440
public function getPreviousExceptions()
    {
        if ($this->previousExceptions === null) {
            $this->previousExceptions = [];

            $prev = $this->exception->getPrevious();
            while ($prev !== null) {
                $this->previousExceptions[] = $prev;
                $prev = $prev->getPrevious();
            }
        }

        return $this->previousExceptions;
    }
741246
protected function _exception() {
        $url = '.' . $this->request->src . '.' . $this->request->controller . '.' . $this->request->action;

        if (in_array($url, $this->config['user']['security']['spam']['config']['exception'])) {
            $this->_exception = true;
        }

        return $this->_exception;
    }
984532
private function getError() {
        if (!curl_errno($this->curl)) return array();
        return array('error_no' => curl_errno($this->curl), 'error' => curl_error($this->curl));
    }
297565
public function getResult()
    {
        $result = parent::getResult();
        if (is_array($result) && isset($result['error'])) {
            throw new Exception($result['error']);
        }
        return $result;
    }
772599
public function convert(\Exception $ex)
    {
        $exceptions = array();

        do {
            $exceptions[] = $this->convertException($ex);
        } while (null !== $ex = $ex->getPrevious());

        return $exceptions;
    }
1261060
protected function getError() {
		if ($this->_error === false) {
			if (is_resource($this->_dbh)) {
				$this->_error = @oci_error($this->_dbh);
			}
			else {
				$this->_error = @oci_error();
			}
		}

		return $this->_error;
	}
353942
protected function getExceptionName()
    {
        if ($this->exception instanceof Exception) {
            $name = $this->exception->getName();
        } elseif ($this->exception instanceof ErrorException) {
            $name = $this->exception->getName();
        } else {
            $name = $this->defaultName;
        }
        return $name;
    }
170660
public function getExceptions(): array
    {
        $memory = $this->getMemory();

        $exceptions = $this->unserialize($memory);

        shmop_write($memory, serialize([]), 0);

        shmop_close($memory);

        return $exceptions;
    }