Skip to content

Apache Lucene open-source search software

added a sttaic method to get the enum from an int code

Noble Paul6981083fc39a
diff --git a/src/common/org/apache/solr/common/SolrException.java b/src/common/org/apache/solr/common/SolrException.java
index bdc516c95bf..582db467fcc 100644
--- a/src/common/org/apache/solr/common/SolrException.java
+++ b/src/common/org/apache/solr/common/SolrException.java
@@ -36,14 +36,20 @@ public class SolrException extends RuntimeException {
FORBIDDEN( 403 ),
NOT_FOUND( 404 ),
SERVER_ERROR( 500 ),
- SERVICE_UNAVAILABLE( 503 );
-
+ SERVICE_UNAVAILABLE( 503 ),
+ UNKNOWN(0);
final int code;
private ErrorCode( int c )
{
code = c;
}
+ public static ErrorCode getErrorCode(int c){
+ for (ErrorCode err : values()) {
+ if(err.code == c) return err;
+ }
+ return UNKNOWN;
+ }
};
public boolean logged=false;