dentiny commented on issue #1038:
URL: https://github.com/apache/iceberg-rust/issues/1038#issuecomment-2832921814

   Hi team, I'm wondering if there're further discussions or conclusions for 
error type?
   
   One thing @Xuanwo mentioned in the error handling design philosophy is
   > The caller can decide how to handle this error.
   
   There're multiple ways to handle error:
   - Ignore and do nothing: not recommended unless reasonable under particular 
cases;
   - Propagate to caller (and maybe add more context);
   - Panic / throw / exit the program: the error is not handle-able by all 
means, so we need to declare program dead right away, for example fsyncgage;
   - Handle the error by retry.
   
   I think for our current error code design is not really ideal for the fourth 
handle (retry) :(
   Basically we need to tell whether the error is retriable or not, if the 
error source uses `Unexpected` in most of the cases (i.e. namespace already 
exists), the error code loss part of its purpose to serve as a indicator to 
decide retry or not.
   
   I opened another related 
[issue](https://github.com/apache/iceberg-rust/issues/1249) on error handling, 
and copy some of my opinion here (sorry I didn't notice we already have a 
discussion thread):
   
   > grpc status works pretty well based on my limited experiment (might be 
biased, so I'm happy to hear other opinions), the limited ~20 types of errors 
are able to represent almost all errors I've ever met.
   https://grpc.io/docs/guides/status-codes/
   
   whether grpc status is retriable is more defined, and there's well-defined 
translation from http status code to grpc status code: 
https://github.com/tensorflow/tensorflow/blob/16e81eaeb783e77133335d05001a7b866c771065/third_party/xla/xla/tsl/platform/cloud/curl_http_request.cc#L469-L539
   
   > Adding a separate error type for the catalog doesn't make it easier for 
users; instead, it adds more work on their end.
   At this stage, I think it would be good to have ErrorKind::TableNotFound and 
ErrorKind::NamespaceExists. Users can easily handle these errors and obtain 
detailed information from the error message or context.
   
   I also agree on this argument, I would like to add error types only when 
necessary.
   `NotFound` and `AlreadyExists` seems reasonable requires little code change.


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