Skip to content

Commit

Permalink
Add some logging to DevModeClient in the case of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Nov 29, 2023
1 parent 6752370 commit cce888f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test-framework/devmode-test-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<name>Quarkus - Test Framework - Dev Mode Test Utils</name>

<dependencies>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.jboss.logging.Logger;

import io.smallrye.common.os.OS;

public class DevModeClient {

private static final long DEFAULT_TIMEOUT = OS.current() == OS.WINDOWS ? 3L : 1L;

private static final Logger LOG = Logger.getLogger(DevModeClient.class);

static long getDefaultTimeout() {
return DEFAULT_TIMEOUT;
}
Expand Down Expand Up @@ -180,6 +183,10 @@ public String getHttpResponse(String path, boolean allowError, Supplier<String>
resp.set(content);
return true;
} catch (Exception e) {
LOG.error(
"An error occurred when DevModeClient accessed " + path
+ ". It might be a normal testing behavior but logging the exception for information",
e);
return false;
}
});
Expand All @@ -206,6 +213,10 @@ public boolean getHttpResponse(String path, int expectedStatus, long timeout, Ti
}
return false;
} catch (Exception e) {
LOG.error(
"An error occurred when DevModeClient accessed " + path
+ ". It might be a normal testing behavior but logging the exception for information",
e);
return false;
}
});
Expand All @@ -227,6 +238,10 @@ public boolean getStrictHttpResponse(String path, int expectedStatus) {
//complete no matter what the response code was
return true;
} catch (Exception e) {
LOG.error(
"An error occurred when DevModeClient accessed " + path
+ ". It might be a normal testing behavior but logging the exception for information",
e);
return false;
}
});
Expand Down

0 comments on commit cce888f

Please sign in to comment.