Skip to content

Commit

Permalink
Throw EmbeddedRedisException if server fails to start
Browse files Browse the repository at this point in the history
  • Loading branch information
eager-signal committed Oct 18, 2024
1 parent ce50da9 commit 94893fd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/redis/embedded/AbstractRedisInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ private void logErrors() {
private void awaitRedisServerReady() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(redisProcess.getInputStream()));
try {
StringBuffer outputStringBuffer = new StringBuffer();
StringBuilder outputStringBuilder = new StringBuilder();
String outputLine;
do {
outputLine = reader.readLine();
if (outputLine == null) {
//Something goes wrong. Stream is ended before server was activated.
throw new RuntimeException("Can't start redis server. Check logs for details. Redis process log: " + outputStringBuffer.toString());
// Something is wrong. Stream ended before server was activated.
throw new EmbeddedRedisException("Redis server failed to become ready. Check logs for details. Redis process log: " + outputStringBuilder.toString());
} else {
outputStringBuffer.append("\n");
outputStringBuffer.append(outputLine);
outputStringBuilder.append("\n");
outputStringBuilder.append(outputLine);
}
} while (!outputLine.matches(redisReadyPattern()));
} finally {
Expand Down

0 comments on commit 94893fd

Please sign in to comment.