28#include "iceberg/iceberg_export.h"
35 kAuthenticationFailed,
64 kRetryableValidationFailed,
72struct ICEBERG_EXPORT [[nodiscard]]
Error {
84template <typename T, typename E = typename DefaultError<T>::type>
85using Result = std::expected<T, E>;
87using Status = Result<void>;
90#define DEFINE_ERROR_FUNCTION(name) \
91 template <typename... Args> \
92 inline auto name(const std::format_string<Args...> fmt, Args&&... args) \
93 -> std::unexpected<Error> { \
94 return std::unexpected<Error>( \
95 {ErrorKind::k##name, std::format(fmt, std::forward<Args>(args)...)}); \
97 inline auto name(std::string message) -> std::unexpected<Error> { \
98 return std::unexpected<Error>({ErrorKind::k##name, std::move(message)}); \
101DEFINE_ERROR_FUNCTION(AlreadyExists)
102DEFINE_ERROR_FUNCTION(AuthenticationFailed)
103DEFINE_ERROR_FUNCTION(BadRequest)
104DEFINE_ERROR_FUNCTION(CommitFailed)
105DEFINE_ERROR_FUNCTION(CommitStateUnknown)
106DEFINE_ERROR_FUNCTION(DecompressError)
107DEFINE_ERROR_FUNCTION(Forbidden)
108DEFINE_ERROR_FUNCTION(InternalServerError)
109DEFINE_ERROR_FUNCTION(Invalid)
110DEFINE_ERROR_FUNCTION(InvalidArgument)
111DEFINE_ERROR_FUNCTION(InvalidArrowData)
112DEFINE_ERROR_FUNCTION(InvalidExpression)
113DEFINE_ERROR_FUNCTION(InvalidManifest)
114DEFINE_ERROR_FUNCTION(InvalidManifestList)
115DEFINE_ERROR_FUNCTION(InvalidSchema)
116DEFINE_ERROR_FUNCTION(IOError)
117DEFINE_ERROR_FUNCTION(JsonParseError)
118DEFINE_ERROR_FUNCTION(NamespaceNotEmpty)
119DEFINE_ERROR_FUNCTION(NoSuchNamespace)
120DEFINE_ERROR_FUNCTION(NoSuchPlanId)
121DEFINE_ERROR_FUNCTION(NoSuchPlanTask)
122DEFINE_ERROR_FUNCTION(NoSuchTable)
123DEFINE_ERROR_FUNCTION(NoSuchWarehouse)
124DEFINE_ERROR_FUNCTION(NoSuchView)
125DEFINE_ERROR_FUNCTION(NotAllowed)
126DEFINE_ERROR_FUNCTION(NotAuthorized)
127DEFINE_ERROR_FUNCTION(NotFound)
128DEFINE_ERROR_FUNCTION(NotImplemented)
129DEFINE_ERROR_FUNCTION(NotSupported)
130DEFINE_ERROR_FUNCTION(RestError)
131DEFINE_ERROR_FUNCTION(RetryableValidationFailed)
132DEFINE_ERROR_FUNCTION(ServiceUnavailable)
133DEFINE_ERROR_FUNCTION(TokenExpired)
134DEFINE_ERROR_FUNCTION(UnknownError)
135DEFINE_ERROR_FUNCTION(ValidationFailed)
137#undef DEFINE_ERROR_FUNCTION
140concept AsResult = std::derived_from<std::remove_cvref_t<T>,
141 Result<typename std::remove_cvref_t<T>::value_type>>;
144using ResultValueT =
typename std::remove_cvref_t<T>::value_type;
/brief Default error trait
Definition result.h:79
Error with a kind and a message.
Definition result.h:72