mirror of https://github.com/apache/lucene.git
added a sttaic method to get the enum from an int code
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@786784 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9e4e91f885
commit
6981083fc3
|
@ -36,14 +36,20 @@ public class SolrException extends RuntimeException {
|
||||||
FORBIDDEN( 403 ),
|
FORBIDDEN( 403 ),
|
||||||
NOT_FOUND( 404 ),
|
NOT_FOUND( 404 ),
|
||||||
SERVER_ERROR( 500 ),
|
SERVER_ERROR( 500 ),
|
||||||
SERVICE_UNAVAILABLE( 503 );
|
SERVICE_UNAVAILABLE( 503 ),
|
||||||
|
UNKNOWN(0);
|
||||||
final int code;
|
final int code;
|
||||||
|
|
||||||
private ErrorCode( int c )
|
private ErrorCode( int c )
|
||||||
{
|
{
|
||||||
code = 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;
|
public boolean logged=false;
|
||||||
|
|
Loading…
Reference in New Issue