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

Himanshu Gahlaut edited comment on LENS-187 at 5/7/15 1:47 PM:
---------------------------------------------------------------

Yes we can do this. We shall make sure that all enums to be moved from 
ErrorMsg.java to LensCubeErrorCode.java are only used inside lens-cube module 
for modularity. If they are used outside of lens-cube module, then we shall 
move them to a separate error code enum of the module in which they are used.

Steps to do the same:

1) Create a corresponding enum in LensCubeErrorCode. E.g.: 
LensCubeErrorCode.COLUMN_UNAVAILABLE_IN_TIME_RANGE  is an already moved 
equivalent Enum for ErrorMsg.NOT_AVAILABLE_IN_RANGE.

2) Define an error object in lensCubeErrors array in lens-errors.conf with the 
same error code as the error code used in LensCubeErrorCode enum.

3) Either throw a LensException using appropriate constructor from the location 
where error occurs. E.g. (a) 
https://github.com/apache/incubator-lens/blob/master/lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java#L146
 (b) 
https://github.com/apache/incubator-lens/blob/master/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java#L79
 

OR

4) If some structured data has to be transferred in Error Response for the use 
of clients to create client specfic error messages, then create an error 
payload class and a subclass of lens exception to override buildLensErrorTO and 
getFormattedErrorMsg functions, and throw the subclass instead of 
LensException. Use ColUnAvailableInTimeRangeException which carries 
ColUnAvailableInTimeRange error payload class as reference. 
https://github.com/apache/incubator-lens/blob/master/lens-cube/src/main/java/org/apache/lens/cube/parse/TimerangeResolver.java#L239


was (Author: himanshu.gahlaut):
Yes we can do this. We shall make sure that all enums to be moved from 
ErrorMsg.java to LensCubeErrorCode.java are only used inside lens-cube module 
for modularity. If they are used outside of lens-cube module, then we shall 
move them to a separate error code enum of the module in which they are used.

Steps to do the same:

1) Create a corresponding enum in LensCubeErrorCode. E.g.: 
LensCubeErrorCode.COLUMN_UNAVAILABLE_IN_TIME_RANGE  is an already moved 
equivalent Enum for ErrorMsg.NOT_AVAILABLE_IN_RANGE.

2) Define an error object in lensCubeErrors array in lens-errors.conf with the 
same error code as the error code used in LensCubeErrorCode enum.

3) Either throw a LensException using appropriate constructor from the location 
where error occurs. E.g. (a) 
https://github.com/apache/incubator-lens/blob/master/lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java#L146
 (b) 
https://github.com/apache/incubator-lens/blob/master/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java#L79
 
OR
4) If some structured data has to be transferred in Error Response for the use 
of clients to create client specfic error messages, then create an error 
payload class and a subclass of lens exception to override buildLensErrorTO and 
getFormattedErrorMsg functions, and throw the subclass instead of 
LensException. Use ColUnAvailableInTimeRangeException which carries 
ColUnAvailableInTimeRange error payload class as reference.

> Move cube specific error message codes from InMobi's Hive code to Lens
> ----------------------------------------------------------------------
>
>                 Key: LENS-187
>                 URL: https://issues.apache.org/jira/browse/LENS-187
>             Project: Apache Lens
>          Issue Type: Bug
>          Components: cube
>            Reporter: Jaideep Dhok
>            Assignee: Himanshu Gahlaut
>             Fix For: 2.2
>
>
> Cube code has been moved into Lens, but the error messages used by lens-cube 
> still remain in the InMobi's Hive fork. This is to track and move all cube 
> related error messages from (InMobi) Hive to Lens.



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

Reply via email to