iceberg-cpp
Loading...
Searching...
No Matches
error_handlers.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
22#include <memory>
23
24#include "iceberg/catalog/rest/iceberg_rest_export.h"
26#include "iceberg/result.h"
27
30
31namespace iceberg::rest {
32
35class ICEBERG_REST_EXPORT ErrorHandler {
36 public:
37 virtual ~ErrorHandler() = default;
38
43 virtual Status Accept(const ErrorResponse& error) const = 0;
44};
45
47class ICEBERG_REST_EXPORT DefaultErrorHandler : public ErrorHandler {
48 public:
50 static const std::shared_ptr<DefaultErrorHandler>& Instance();
51
52 Status Accept(const ErrorResponse& error) const override;
53
54 protected:
55 constexpr DefaultErrorHandler() = default;
56};
57
59class ICEBERG_REST_EXPORT NamespaceErrorHandler : public DefaultErrorHandler {
60 public:
62 static const std::shared_ptr<NamespaceErrorHandler>& Instance();
63
64 Status Accept(const ErrorResponse& error) const override;
65
66 protected:
67 constexpr NamespaceErrorHandler() = default;
68};
69
71class ICEBERG_REST_EXPORT DropNamespaceErrorHandler final : public NamespaceErrorHandler {
72 public:
74 static const std::shared_ptr<DropNamespaceErrorHandler>& Instance();
75
76 Status Accept(const ErrorResponse& error) const override;
77
78 private:
79 constexpr DropNamespaceErrorHandler() = default;
80};
81
83class ICEBERG_REST_EXPORT TableErrorHandler final : public DefaultErrorHandler {
84 public:
86 static const std::shared_ptr<TableErrorHandler>& Instance();
87
88 Status Accept(const ErrorResponse& error) const override;
89
90 private:
91 constexpr TableErrorHandler() = default;
92};
93
95class ICEBERG_REST_EXPORT ViewErrorHandler final : public DefaultErrorHandler {
96 public:
98 static const std::shared_ptr<ViewErrorHandler>& Instance();
99
100 Status Accept(const ErrorResponse& error) const override;
101
102 private:
103 constexpr ViewErrorHandler() = default;
104};
105
107class ICEBERG_REST_EXPORT TableCommitErrorHandler final : public DefaultErrorHandler {
108 public:
110 static const std::shared_ptr<TableCommitErrorHandler>& Instance();
111
112 Status Accept(const ErrorResponse& error) const override;
113
114 private:
115 constexpr TableCommitErrorHandler() = default;
116};
117
119class ICEBERG_REST_EXPORT ViewCommitErrorHandler final : public DefaultErrorHandler {
120 public:
122 static const std::shared_ptr<ViewCommitErrorHandler>& Instance();
123
124 Status Accept(const ErrorResponse& error) const override;
125
126 private:
127 constexpr ViewCommitErrorHandler() = default;
128};
129
130} // namespace iceberg::rest
Default error handler for REST API responses.
Definition error_handlers.h:47
Error handler for drop namespace operations.
Definition error_handlers.h:71
Error handler interface for processing REST API error responses. Maps HTTP status codes to appropriat...
Definition error_handlers.h:35
virtual Status Accept(const ErrorResponse &error) const =0
Process an error response and return an appropriate Error.
Namespace-specific error handler for create/read/update operations.
Definition error_handlers.h:59
Table commit operation error handler.
Definition error_handlers.h:107
Table-level error handler.
Definition error_handlers.h:83
View commit operation error handler.
Definition error_handlers.h:119
View-level error handler.
Definition error_handlers.h:95
JSON error payload returned in a response with further details on the error.
Definition types.h:55