Models the possibly of failure for remote HTTP operations. More...
#include <curl_result.hpp>
Public Types | |
using | error_type = std::variant< CURLcode, curl_slist * > |
Public Member Functions | |
constexpr | curl_result (CURLcode code) noexcept |
Constructs a result from a CURL error code. More... | |
constexpr | curl_result (curl_slist *list) noexcept |
Constructs a result from a CURL header list. More... | |
constexpr auto | is_success () const noexcept -> bool |
constexpr auto | is_error () const noexcept -> bool |
constexpr auto | error () const noexcept -> error_type |
Retrieves the error type associated with a failed operation. Cannot be called on a successful result. More... | |
constexpr auto | and_then (std::function< curl_result()> const &func) const noexcept -> curl_result |
Runs a transformation function on a successful result; does nothing on a failed result. More... | |
auto | to_string () const noexcept -> std::string |
Retrieves the string representation of the current instance. More... | |
Static Public Member Functions | |
static auto | to_string (error_type const &err) noexcept -> std::string |
Retrieves the string representation of a failed operation. More... | |
Models the possibly of failure for remote HTTP operations.
Definition at line 20 of file curl_result.hpp.
|
inlineconstexprnoexcept |
Constructs a result from a CURL error code.
This constructor is intentionally non-explicit to facilitate converting construction.
Definition at line 30 of file curl_result.hpp.
|
inlineconstexprnoexcept |
Constructs a result from a CURL header list.
This constructor is intentionally non-explicit to facilitate converting construction.
Definition at line 44 of file curl_result.hpp.
|
inlineconstexprnoexcept |
Runs a transformation function on a successful result; does nothing on a failed result.
func | the transformation function to apply on a successful result |
Definition at line 80 of file curl_result.hpp.
|
inlineconstexprnoexcept |
Retrieves the error type associated with a failed operation. Cannot be called on a successful result.
Definition at line 69 of file curl_result.hpp.
|
inlineconstexprnoexcept |
Definition at line 61 of file curl_result.hpp.
|
inlineconstexprnoexcept |
Definition at line 56 of file curl_result.hpp.
|
inlinenoexcept |
Retrieves the string representation of the current instance.
The format of the string returned by this function is not specified and should not be relied upon programmatically.
Definition at line 110 of file curl_result.hpp.
Referenced by pinecone::util::result< T >::to_string().
|
inlinestaticnoexcept |
Retrieves the string representation of a failed operation.
err | the error to stringify |
Definition at line 95 of file curl_result.hpp.