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:
Noble Paul 2009-06-20 10:02:42 +00:00
parent 9e4e91f885
commit 6981083fc3
1 changed files with 8 additions and 2 deletions

View File

@ -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;