yuqi1129 commented on PR #6853:
URL: https://github.com/apache/gravitino/pull/6853#issuecomment-2785056723

   > Could you reuse the method `getEntity` in the class `OperationDispatcher`?
   
   <img width="1306" alt="image" 
src="https://github.com/user-attachments/assets/f6652cbe-2858-41d0-bbde-f0c5e1d7f0e8";
 />
   
   
   > > > > OperationDispatcher
   > > > 
   > > > 
   > > > OK, let me take a look.
   > > 
   > > 
   > > It seems that we can't use it directly as the method `getEntity` will 
throw exceptions when the entity does not exist and that's not what the code in 
this PR intends to do.
   > 
   > It should be ok that the `getEntity` method don't throw the exception. You 
can unify them.
   
   <img width="1306" alt="image" 
src="https://github.com/user-attachments/assets/54580e83-85cb-4520-a9f8-205f066e742a";
 />
   
   It appears that this method is not designed to throw exceptions. do you mean 
I can use a flag to throw execution or not in this method?
   
    protected <E extends Entity & HasIdentifier> E getEntity(
         NameIdentifier ident, Entity.EntityType type, Class<E> entityClass, 
bool throwExcetion) {
       try {
         return store.get(ident, type, entityClass);
       } catch (Exception e) {
         if (!throwExcetion) {
             LOG.warn(""); 
             return null;
         }
         LOG.error(FormattedErrorMessages.STORE_OP_FAILURE, "get", ident, e);
         throw new RuntimeException("Fail to check if entity is existed", e);
       }
     }


-- 
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: commits-unsubscr...@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to