You are here

private function Client::jsonErrorDescription in Smart IP 7.2

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

Return value

string describing the JSON error

3 calls to Client::jsonErrorDescription()
Client::handle4xx in includes/vendor/maxmind/web-service-common/src/WebService/Client.php
Client::handleSuccess in includes/vendor/maxmind/web-service-common/src/WebService/Client.php
Client::post in includes/vendor/maxmind/web-service-common/src/WebService/Client.php

File

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

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 jsonErrorDescription() {
  $errno = json_last_error();
  switch ($errno) {
    case JSON_ERROR_DEPTH:
      return 'The maximum stack depth has been exceeded.';
    case JSON_ERROR_STATE_MISMATCH:
      return 'Invalid or malformed JSON.';
    case JSON_ERROR_CTRL_CHAR:
      return 'Control character error.';
    case JSON_ERROR_SYNTAX:
      return 'Syntax error.';
    case JSON_ERROR_UTF8:
      return 'Malformed UTF-8 characters.';
    default:
      return "Other JSON error ({$errno}).";
  }
}