Uploaded image for project: 'Sqoop (Retired)'
  1. Sqoop (Retired)
  2. SQOOP-649

REST API : Stop using exceptions as a way to transfer regular error states between client and server

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0
    • 2.0.0
    • None
    • None

    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.

      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);
        }
      
      }
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jarcec Jarek Jarcec Cecho
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: