You are here

private function Client::handleWebServiceError in Smart IP 6.2

Same name and namespace in other branches
  1. 7.2 includes/vendor/maxmind/web-service-common/src/WebService/Client.php \MaxMind\WebService\Client::handleWebServiceError()

Parameters

string $message The error message from the web service:

string $code The error code from the web service:

int $statusCode The HTTP status code:

string $path The path used in the request:

Throws

AuthenticationException

InvalidRequestException

InsufficientFundsException

1 call to Client::handleWebServiceError()
Client::handle4xx in includes/vendor/maxmind/web-service-common/src/WebService/Client.php

File

includes/vendor/maxmind/web-service-common/src/WebService/Client.php, line 305

Class

Client
This class is not intended to be used directly by an end-user of a MaxMind web service. Please use the appropriate client API for the service that you are using. @package MaxMind\WebService @internal

Namespace

MaxMind\WebService

Code

private function handleWebServiceError($message, $code, $statusCode, $path) {
  switch ($code) {
    case 'IP_ADDRESS_NOT_FOUND':
    case 'IP_ADDRESS_RESERVED':
      throw new IpAddressNotFoundException($message, $code, $statusCode, $this
        ->urlFor($path));
    case 'AUTHORIZATION_INVALID':
    case 'LICENSE_KEY_REQUIRED':
    case 'USER_ID_REQUIRED':
    case 'USER_ID_UNKNOWN':
      throw new AuthenticationException($message, $code, $statusCode, $this
        ->urlFor($path));
    case 'OUT_OF_QUERIES':
    case 'INSUFFICIENT_FUNDS':
      throw new InsufficientFundsException($message, $code, $statusCode, $this
        ->urlFor($path));
    case 'PERMISSION_REQUIRED':
      throw new PermissionRequiredException($message, $code, $statusCode, $this
        ->urlFor($path));
    default:
      throw new InvalidRequestException($message, $code, $statusCode, $this
        ->urlFor($path));
  }
}