Cppinecone
A C++ client for the Pinecone vector database
result.hpp File Reference

Models the possibility of failure for Pinecone operations. More...

#include <sstream>
#include <string>
#include <variant>
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include "pinecone/types/error.hpp"
#include "pinecone/util/curl_result.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pinecone::util::failure_reason< F >
 Data associated with the possible failure modes for Cppinecone operations. More...
 
struct  pinecone::util::failure_reason< failure::request_rejected >
 A request that was rejected by the remote API. More...
 
struct  pinecone::util::failure_reason< failure::request_failed >
 A request that was processed by the remote API, but failed during processing. More...
 
struct  pinecone::util::failure_reason< failure::parsing_failed >
 A request that succeeded on the remote server, but whose response could not be parsed. More...
 
struct  pinecone::util::result< T >
 Models the possibility of failure for all Cppinecone public API operations. More...
 

Typedefs

using json = nlohmann::json
 
using pinecone::util::request_rejected = failure_reason< failure::request_rejected >
 
using pinecone::util::request_failed = failure_reason< failure::request_failed >
 
using pinecone::util::parsing_failed = failure_reason< failure::parsing_failed >
 

Enumerations

enum class  pinecone::util::failure { none , request_rejected , request_failed , parsing_failed }
 The possible ways in which a Pinecone API call can fail. More...
 

Detailed Description

Models the possibility of failure for Pinecone operations.

Definition in file result.hpp.

Enumeration Type Documentation

◆ failure

The possible ways in which a Pinecone API call can fail.

While there are many different reasons why any one of these failure modes may occur, API users are likely to handle failures depending on which of these categories the failure belongs to. For example, there is likely little that a client can do about parsing_failed, but retrying a request_rejected in the future could be a reasonable course of action.

Enumerator
none 

No failure; the request was processed and succeeded as expected.

request_rejected 

The API request was sent successfully, but the server did not respond. This usually indicates a Pinecone outage or client-side network misconfiguration, but could potentially also be caused by a bug in cppinecone depending on the error code.

request_failed 

The API request was sent successfully, but the server returned a non-200 HTTP response. This usually indicates a bug within the client code, such as providing an invalid index name or invalid api key.

parsing_failed 

The API request was sent and processed successfully by the server, but the server's response could not be parsed. This usually indicates a bug in cppinecone and should not be expected during standard use.

Definition at line 31 of file result.hpp.