if ($json === false) {
            $error = error_get_last();
            $exception = null;

            if ($error !== null) {