HeartLinked commented on code in PR #1919:
URL: https://github.com/apache/iceberg-rust/pull/1919#discussion_r2609323969


##########
crates/iceberg/src/error.rs:
##########
@@ -63,6 +63,47 @@ pub enum ErrorKind {
 
     /// Catalog commit failed due to outdated metadata
     CatalogCommitConflicts,
+
+    /// Catalog commit state is unknown after a server error.
+    ///
+    /// This error is returned when a commit operation receives a 5xx response,
+    /// indicating the server failed but the commit state is uncertain.
+    CommitStateUnknown,
+
+    /// Namespace is not empty and cannot be dropped.
+    ///
+    /// This error is returned when attempting to drop a namespace that still
+    /// contains tables or other resources.
+    NamespaceNotEmpty,
+
+    /// Iceberg view does not exist.
+    ViewNotFound,
+
+    /// Iceberg view already exists at creation.
+    ViewAlreadyExists,
+
+    /// Service is temporarily unavailable.
+    ///
+    /// This error is returned when the server returns a 503 Service 
Unavailable status.
+    ServiceUnavailable,
+
+    /// Bad request.
+    ///
+    /// This error is returned when the server returns a 400 Bad Request 
status,
+    /// indicating a malformed or invalid request.
+    BadRequest,
+
+    /// Forbidden.
+    ///
+    /// This error is returned when the server returns a 403 Forbidden status,
+    /// indicating the client does not have permission to perform the 
operation.
+    Forbidden,
+
+    /// Not authorized.
+    ///
+    /// This error is returned when the server returns a 401 Unauthorized 
status,
+    /// indicating the client is not authenticated.
+    NotAuthorized,

Review Comment:
   > I do like this direction of expanding the error kinds but I feel like this 
will need more discussion. Imo something like the `IoErrorKind` mentioned 
[here](https://github.com/apache/iceberg-rust/pull/1885#discussion_r2559571358) 
would be cleaner
   
   Yes, I think this is a question worth discussing. And I've noticed that some 
error types might be reused by other catalogs (e.g., "`CatalogCommitConflicts`" 
which already existed prior to this PR), while others may be used across 
various modules. Therefore, drawing a clean distinction between types like 
"`RestErrorKind`" or "`CatalogErrorKind`" would require additional effort and 
careful checking. If you consider this necessary, I’m open to this suggestion.



##########
crates/iceberg/src/error.rs:
##########
@@ -63,6 +63,47 @@ pub enum ErrorKind {
 
     /// Catalog commit failed due to outdated metadata
     CatalogCommitConflicts,
+
+    /// Catalog commit state is unknown after a server error.
+    ///
+    /// This error is returned when a commit operation receives a 5xx response,
+    /// indicating the server failed but the commit state is uncertain.
+    CommitStateUnknown,
+
+    /// Namespace is not empty and cannot be dropped.
+    ///
+    /// This error is returned when attempting to drop a namespace that still
+    /// contains tables or other resources.
+    NamespaceNotEmpty,
+
+    /// Iceberg view does not exist.
+    ViewNotFound,
+
+    /// Iceberg view already exists at creation.
+    ViewAlreadyExists,
+
+    /// Service is temporarily unavailable.
+    ///
+    /// This error is returned when the server returns a 503 Service 
Unavailable status.
+    ServiceUnavailable,
+
+    /// Bad request.
+    ///
+    /// This error is returned when the server returns a 400 Bad Request 
status,
+    /// indicating a malformed or invalid request.
+    BadRequest,
+
+    /// Forbidden.
+    ///
+    /// This error is returned when the server returns a 403 Forbidden status,
+    /// indicating the client does not have permission to perform the 
operation.
+    Forbidden,
+
+    /// Not authorized.
+    ///
+    /// This error is returned when the server returns a 401 Unauthorized 
status,
+    /// indicating the client is not authenticated.
+    NotAuthorized,

Review Comment:
   Since `CatalogCommitConflicts` already exists, simply adding new entries 
after it might be the easiest temporary solution — that’s why I implemented it 
this way. 



-- 
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]

Reply via email to