[ 
https://issues.apache.org/jira/browse/TAJO-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627416#comment-14627416
 ] 

ASF GitHub Bot commented on TAJO-1670:
--------------------------------------

Github user hyunsik commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/621#discussion_r34640894
  
    --- Diff: 
tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
 ---
    @@ -51,113 +55,132 @@ public AbstractCatalogClient(TajoConf conf) {
         this.conf = conf;
       }
     
    -  abstract CatalogProtocolService.BlockingInterface getStub() throws 
ServiceException;
    +  abstract BlockingInterface getStub() throws ServiceException;
     
       @Override
       public final Boolean createTablespace(final String tablespaceName, final 
String tablespaceUri) {
    +
         try {
    -      CatalogProtocolService.BlockingInterface stub = getStub();
    +      final BlockingInterface stub = getStub();
    +      final CreateTablespaceRequest request = 
CreateTablespaceRequest.newBuilder()
    +          .setTablespaceName(tablespaceName)
    +          .setTablespaceUri(tablespaceUri)
    +          .build();
     
    -      CreateTablespaceRequest.Builder builder = 
CreateTablespaceRequest.newBuilder();
    -      builder.setTablespaceName(tablespaceName);
    -      builder.setTablespaceUri(tablespaceUri);
    -      return stub.createTablespace(null, builder.build()).getValue();
    -    } catch (Exception e) {
    -      LOG.error(e.getMessage(), e);
    -      return Boolean.FALSE;
    +      return isSuccess(stub.createTablespace(null, request));
    +
    +    } catch (ServiceException e) {
    +      throw new RuntimeException(e);
    --- End diff --
    
    I used RuntimeException for unexpected error. In my design, the server API 
call never throws ServiceException, only communication or netty will throw 
ServiceException. This case will occur rarely, so I used RuntimeException.
    
    In addition, catalog and client API will be improved further to have API 
specific exceptions. For example, createTablespace will throw 
DuplicateTablespaceException and dropTable will throw UndefinedTableException. 
But, this approach significantly changes lots of parts. So, I'll do it in 
following works.


> Refactor client errors and exceptions
> -------------------------------------
>
>                 Key: TAJO-1670
>                 URL: https://issues.apache.org/jira/browse/TAJO-1670
>             Project: Tajo
>          Issue Type: Sub-task
>          Components: Java Client, TajoMaster, Worker
>            Reporter: Hyunsik Choi
>            Assignee: Hyunsik Choi
>             Fix For: 0.11.0
>
>
> The main objective is to refactor the error and exception system in client 
> side and its connected parts like TajoMaster.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to