[ 
https://issues.apache.org/jira/browse/SQOOP-649?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Veena Basavaraj updated SQOOP-649:
----------------------------------
    Description: 
We're currently using exceptions as means of moving incorrect states between 
client and server. For example "Can't delete this job id as it already exists", 
... I believe that we should encode such issues in more better way and use 
exceptions only for exceptional state.

{code}
public enum SqoopResponseCode {

  SQOOP_1000("1000", "OK"),
  SQOOP_2000("2000", "ERROR");

  private final String code;
  private final String message;

  private SqoopResponseCode(String code, String message) {
    this.code = code;
    this.message = message;
  }

  public String getCode() {
    return code;
  }

  public String getMessage() {
    return message;
  }

  public static SqoopResponseCode getFromCode(String code) {
    return SqoopResponseCode.valueOf("SQOOP_" + code);
  }

}

{code}

  was:We're currently using exceptions as means of moving incorrect states 
between client and server. For example "Can't delete this job id as it already 
exists", ... I believe that we should encode such issues in more better way and 
use exceptions only for exceptional state.


> REST API : Stop using exceptions as a way to transfer regular error states 
> between client and server
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SQOOP-649
>                 URL: https://issues.apache.org/jira/browse/SQOOP-649
>             Project: Sqoop
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Jarek Jarcec Cecho
>            Assignee: Veena Basavaraj
>             Fix For: 1.99.5
>
>
> We're currently using exceptions as means of moving incorrect states between 
> client and server. For example "Can't delete this job id as it already 
> exists", ... I believe that we should encode such issues in more better way 
> and use exceptions only for exceptional state.
> {code}
> public enum SqoopResponseCode {
>   SQOOP_1000("1000", "OK"),
>   SQOOP_2000("2000", "ERROR");
>   private final String code;
>   private final String message;
>   private SqoopResponseCode(String code, String message) {
>     this.code = code;
>     this.message = message;
>   }
>   public String getCode() {
>     return code;
>   }
>   public String getMessage() {
>     return message;
>   }
>   public static SqoopResponseCode getFromCode(String code) {
>     return SqoopResponseCode.valueOf("SQOOP_" + code);
>   }
> }
> {code}



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

Reply via email to