concrete/src/Geolocator/GeolocationResult.php
public function setError($code, $message = '', Exception $innerException = null)
    {
        if ($code == static::ERR_NONE && !$message && $innerException === null) {
            $this->errorCode = static::ERR_NONE;
            $this->errorMessage = '';
            $this->innerException = null;
        } else {
            $code = (int) $code;
            $this->errorCode = $code === static::ERR_NONE ? static::ERR_OTHER : $code;
            $message = trim((string) $message);
            if ($message === '') {
                switch ($this->errorCode) {
                    case static::ERR_NOCURRENTLIBRARY:
                        $this->errorMessage = t("There's no current geolocation library");
                        break;
                    case static::ERR_NOCURRENTIPADDRESS:
                        $this->errorMessage = t('The IP address of the current client is not available');
                        break;
                    case static::ERR_IPNOTPUBLIC:
                        $this->errorMessage = t('The IP address is not in the public IP address ranges');
                        break;
                    case static::ERR_MISCONFIGURED:
                        $this->errorMessage = t('The geolocation library is misconfigured');
                        break;
                    case static::ERR_NETWORK:
                        $this->errorMessage = t('A network error occurred during the geolocalization');
                        break;
                    case static::ERR_LIBRARYSPECIFIC:
                        $this->errorMessage = t('An unspecified error occurred in the geolocation library');
                        break;
                    default:
                        $this->errorMessage = t('An unexpected error occurred in the geolocation library');
                }
            } else {
                $this->errorMessage = $message;
            }
            $this->innerException = $innerException;
        }
    }
public function setError($code, $message = '', Exception $innerException = null)
    {
        if ($code == static::ERR_NONE && !$message && $innerException === null) {
            $this->errorCode = static::ERR_NONE;
            $this->errorMessage = '';
            $this->innerException = null;
        } else {
            $code = (int) $code;
            $this->errorCode = $code === static::ERR_NONE ? static::ERR_OTHER : $code;
            $message = trim((string) $message);
            if ($message === '') {
                switch ($this->errorCode) {
                    case static::ERR_NOCURRENTLIBRARY:
                        $this->errorMessage = t("There's no current geolocation library");
                        break;
                    case static::ERR_NOCURRENTIPADDRESS:
                        $this->errorMessage = t('The IP address of the current client is not available');
                        break;
                    case static::ERR_IPNOTPUBLIC:
                        $this->errorMessage = t('The IP address is not in the public IP address ranges');
                        break;
                    case static::ERR_MISCONFIGURED:
                        $this->errorMessage = t('The geolocation library is misconfigured');
                        break;
                    case static::ERR_NETWORK:
                        $this->errorMessage = t('A network error occurred during the geolocalization');
                        break;
                    case static::ERR_LIBRARYSPECIFIC:
                        $this->errorMessage = t('An unspecified error occurred in the geolocation library');
                        break;
                    default:
                        $this->errorMessage = t('An unexpected error occurred in the geolocation library');
                }
            } else {
                $this->errorMessage = $message;
            }
            $this->innerException = $innerException;
        }
    }
public function setError ( $ code , $ message = '' , Exception $ innerException = null ) { if ( $ code == static :: ERR_NONE && ! $ message && $ innerException === null ) { $ this -> errorCode = static :: ERR_NONE ; $ this -> errorMessage = '' ; $ this -> innerException = null ; } else { $ code = ( int ) $ code ; $ this -> errorCode = $ code === static :: ERR_NONE ? static :: ERR_OTHER : $ code ; $ message = trim ( ( string ) $ message ) ; if ( $ message === '' ) { switch ( $ this -> errorCode ) { case static :: ERR_NOCURRENTLIBRARY : $ this -> errorMessage = t ( "There's no current geolocation library" ) ; break ; case static :: ERR_NOCURRENTIPADDRESS : $ this -> errorMessage = t ( 'The IP address of the current client is not available' ) ; break ; case static :: ERR_IPNOTPUBLIC : $ this -> errorMessage = t ( 'The IP address is not in the public IP address ranges' ) ; break ; case static :: ERR_MISCONFIGURED : $ this -> errorMessage = t ( 'The geolocation library is misconfigured' ) ; break ; case static :: ERR_NETWORK : $ this -> errorMessage = t ( 'A network error occurred during the geolocalization' ) ; break ; case static :: ERR_LIBRARYSPECIFIC : $ this -> errorMessage = t ( 'An unspecified error occurred in the geolocation library' ) ; break ; default : $ this -> errorMessage = t ( 'An unexpected error occurred in the geolocation library' ) ; } } else { $ this -> errorMessage = $ message ; } $ this -> innerException = $ innerException ; } }
Set the error state.

@param int $code one of the GeolocationResult::ERR_... constants
@param string $message the error message
@param Exception|null $innerException the underlying exception causing the error (if available)
Set the error state .