Solr
  1. Solr
  2. SOLR-249

deprecate SolrException( int, ... ) in favor of SolrException( enum, ... )

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None

      Description

      SolrException should return valid HTTP status codes.

      1. SOLR-249-EnumErrorCode.patch
        51 kB
        Ryan McKinley
      2. SOLR-249-EnumErrorCode.patch
        51 kB
        Ryan McKinley

        Activity

        Hide
        Ryan McKinley added a comment -

        This adds an inner enum to SolrException:
        public class SolrException extends RuntimeException {

        public enum ErrorCode {
        BAD_REQUEST( 400 ),
        NOT_FOUND( 404 ),
        SERVER_ERROR( 500 ),
        SERVICE_UNAVALIABLE( 503 );

        final int code;

        private ErrorCode( int c )

        { code = c; }

        };
        ...

        • - - - - - -

        This refactors all the errors to use the enum rather then number.

        Do we want ErrorCode to have its own file?

        Show
        Ryan McKinley added a comment - This adds an inner enum to SolrException: public class SolrException extends RuntimeException { public enum ErrorCode { BAD_REQUEST( 400 ), NOT_FOUND( 404 ), SERVER_ERROR( 500 ), SERVICE_UNAVALIABLE( 503 ); final int code; private ErrorCode( int c ) { code = c; } }; ... - - - - - - This refactors all the errors to use the enum rather then number. Do we want ErrorCode to have its own file?
        Hide
        Otis Gospodnetic added a comment -

        Looks good to me after UNAVALIABLE -> UNAVAILABLE

        Show
        Otis Gospodnetic added a comment - Looks good to me after UNAVALIABLE -> UNAVAILABLE
        Hide
        Ryan McKinley added a comment -

        oh spelling...

        Show
        Ryan McKinley added a comment - oh spelling...
        Hide
        Yonik Seeley added a comment -

        +1 for committing

        Show
        Yonik Seeley added a comment - +1 for committing

          People

          • Assignee:
            Ryan McKinley
            Reporter:
            Ryan McKinley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development