add JedisDataException and JedisConnectionException

This commit is contained in:
Jonathan Leibiusky
2011-01-30 17:46:17 -03:00
parent b4ad7697b7
commit 2a4a43f4cd
31 changed files with 269 additions and 263 deletions

View File

@@ -4,6 +4,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import redis.clients.jedis.exceptions.JedisConnectionException;
import redis.clients.jedis.exceptions.JedisDataException;
import redis.clients.util.RedisInputStream;
import redis.clients.util.RedisOutputStream;
import redis.clients.util.SafeEncoder;
@@ -44,13 +46,13 @@ public final class Protocol {
}
os.flush();
} catch (IOException e) {
throw new JedisException(e);
throw new JedisConnectionException(e);
}
}
private void processError(final RedisInputStream is) {
String message = is.readLine();
throw new JedisException(message);
throw new JedisDataException(message);
}
private Object process(final RedisInputStream is) {
@@ -67,10 +69,10 @@ public final class Protocol {
} else if (b == PLUS_BYTE) {
return processStatusCodeReply(is);
} else {
throw new JedisException("Unknown reply: " + (char) b);
throw new JedisConnectionException("Unknown reply: " + (char) b);
}
} catch (IOException e) {
throw new JedisException(e);
throw new JedisConnectionException(e);
}
return null;
}
@@ -94,7 +96,7 @@ public final class Protocol {
is.readByte();
is.readByte();
} catch (IOException e) {
throw new JedisException(e);
throw new JedisConnectionException(e);
}
return read;