wgtmac commented on code in PR #614:
URL: https://github.com/apache/iceberg-cpp/pull/614#discussion_r3199666076
##########
src/iceberg/catalog/rest/error_handlers.cc:
##########
@@ -183,4 +186,52 @@ Status ViewCommitErrorHandler::Accept(const ErrorResponse&
error) const {
return DefaultErrorHandler::Accept(error);
}
+const std::shared_ptr<ScanPlanErrorHandler>& ScanPlanErrorHandler::Instance() {
+ static const std::shared_ptr<ScanPlanErrorHandler> instance{new
ScanPlanErrorHandler()};
+ return instance;
+}
+
+Status ScanPlanErrorHandler::Accept(const ErrorResponse& error) const {
+ switch (error.code) {
+ case 404:
+ if (error.type == kNoSuchNamespaceException) {
+ return NoSuchNamespace(error.message);
+ }
+ if (error.type == kNoSuchTableException) {
+ return NoSuchTable(error.message);
+ }
+ if (error.type == kNoSuchPlanIdException) {
+ return NoSuchPlanId(error.message);
+ }
+ if (error.type == kNoSuchPlanTaskException) {
+ return NoSuchPlanTask(error.message);
+ }
+ return NotFound(error.message);
+ case 406:
+ return NotSupported(error.message);
Review Comment:
Ah, that's a good call. Now I'm convinced to keep it here. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]