iceberg-cpp
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Macros | Typedefs | Enumerations
result.h File Reference

Define Result, Status, and error helpers. More...

#include <concepts>
#include <expected>
#include <format>
#include <string>
#include <type_traits>
#include "iceberg/iceberg_export.h"

Go to the source code of this file.

Classes

struct  iceberg::Error
 Error with a kind and a message. More...
 
struct  iceberg::DefaultError< T >
 /brief Default error trait More...
 

Namespaces

namespace  iceberg
 Core Apache Iceberg C++ APIs.
 

Concepts

concept  iceberg::AsResult
 

Macros

#define DEFINE_ERROR_FUNCTION(name)
 Macro to define error creation functions.
 

Typedefs

template<typename T , typename E = typename DefaultError<T>::type>
using iceberg::Result = std::expected< T, E >
 Result alias.
 
using iceberg::Status = Result< void >
 
template<AsResult T>
using iceberg::ResultValueT = typename std::remove_cvref_t< T >::value_type
 

Enumerations

enum class  iceberg::ErrorKind {
  kAlreadyExists , kAuthenticationFailed , kBadRequest , kCommitFailed ,
  kCommitStateUnknown , kDecompressError , kForbidden , kInternalServerError ,
  kInvalid , kInvalidArgument , kInvalidArrowData , kInvalidExpression ,
  kInvalidManifest , kInvalidManifestList , kInvalidSchema , kIOError ,
  kJsonParseError , kNamespaceNotEmpty , kNoSuchNamespace , kNoSuchPlanId ,
  kNoSuchPlanTask , kNoSuchTable , kNoSuchWarehouse , kNoSuchView ,
  kNotAllowed , kNotAuthorized , kNotFound , kNotImplemented ,
  kNotSupported , kRestError , kRetryableValidationFailed , kServiceUnavailable ,
  kTokenExpired , kUnknownError , kValidationFailed
}
 Error types for iceberg.
 

Detailed Description

Define Result, Status, and error helpers.

Macro Definition Documentation

◆ DEFINE_ERROR_FUNCTION

#define DEFINE_ERROR_FUNCTION (   name)
Value:
template <typename... Args> \
inline auto name(const std::format_string<Args...> fmt, Args&&... args) \
-> std::unexpected<Error> { \
return std::unexpected<Error>( \
{ErrorKind::k##name, std::format(fmt, std::forward<Args>(args)...)}); \
} \
inline auto name(std::string message) -> std::unexpected<Error> { \
return std::unexpected<Error>({ErrorKind::k##name, std::move(message)}); \
}

Macro to define error creation functions.