Skip to content

Commit

Permalink
Rad 994 add http body response (#440)
Browse files Browse the repository at this point in the history
* log body response on error

* response added

---------

Co-authored-by: calvarez <[email protected]>
  • Loading branch information
caralvarez and calvarez19 authored Nov 7, 2024
1 parent 636f876 commit 6577860
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion a2d2-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
<dependency>
<groupId>io.elimu.a2d2</groupId>
<artifactId>generic-helpers</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<scope>test</scope>
</dependency>
<!-- web development, including Tomcat and spring-webmvc -->
Expand Down
2 changes: 1 addition & 1 deletion fhir-helpers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.elimu.a2d2</groupId>
<artifactId>fhir-helpers</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<packaging>jar</packaging>
<name>fhir-helpers</name>
<url>http://maven.apache.org</url>
Expand Down
2 changes: 1 addition & 1 deletion fhir-query-helper-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</parent>

<artifactId>fhir-query-helper-base</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<description>CDS Helper base</description>

<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.elimu.a2d2.cds.fhir.helper;

import java.util.function.Function;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;

public class FetchCallRetry<T> {

Expand All @@ -17,7 +17,7 @@ public FetchCallRetry(QueryBuilder builder, Function<Object, T> function) {
this.function = function;
}

public T retryRestCall(FhirClientWrapper client) {
public T retryRestCall(FhirClientWrapper client) {
int retries = builder.getRetries();
int delay = builder.getDelay();
int count = 0;
Expand All @@ -34,7 +34,11 @@ public T retryRestCall(FhirClientWrapper client) {
}
log.info("FHIR REST call failed attempt number " + count + " with status " + client.getTracker().getResponseStatusCode() + ". Retrying after waiting " + (delay * count) + "ms");
count++;
} catch (Throwable t) {
} catch (BaseServerResponseException t) {
count++;
log.error("Invocation of call failed with body response: " + t.getResponseBody());
}
catch (Throwable t) {
if (client.getTracker().getResponseStatusCode() >= 0 && client.getTracker().getResponseStatusCode() < 500) {
throw new RuntimeException("Invocation of call failed with status code " + client.getTracker().getResponseStatusCode() + ". No further retries will be performed");
}
Expand Down
2 changes: 1 addition & 1 deletion fhir-query-helper-dstu2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</parent>

<artifactId>fhir-query-helper-dstu2</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<packaging>jar</packaging>
<description>CDS Helper</description>

Expand Down
2 changes: 1 addition & 1 deletion fhir-query-helper-dstu3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</parent>

<artifactId>fhir-query-helper-dstu3</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<packaging>jar</packaging>
<description>CDS Helper DSTU3</description>

Expand Down
2 changes: 1 addition & 1 deletion fhir-query-helper-r4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</parent>

<artifactId>fhir-query-helper-r4</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<packaging>jar</packaging>
<description>CDS Helper R4</description>

Expand Down
2 changes: 1 addition & 1 deletion generic-helpers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<version>0.0.9-SNAPSHOT</version>
</parent>
<artifactId>generic-helpers</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<name>Base helpers for the Generic services</name>
<description>Contains WIHInvoker</description>

Expand Down
2 changes: 1 addition & 1 deletion oauth-helpers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</parent>

<artifactId>oauth-helpers</artifactId>
<version>0.0.19</version>
<version>0.0.20</version>
<description>OAuth Helper</description>

<properties>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<protobuf-java.version>3.21.8</protobuf-java.version>
<mockito.version>2.23.0</mockito.version>
<jedis.version>4.0.1</jedis.version>
<cds.helper.version>0.0.19</cds.helper.version>
<cds.helper.version>0.0.20</cds.helper.version>
<freemarker.version>2.3.30</freemarker.version>
<jacoco.version>0.8.7</jacoco.version>
<jaxb.api.version>2.3.1</jaxb.api.version>
Expand Down Expand Up @@ -233,7 +233,7 @@
<groupId>${project.groupId}</groupId>
<artifactId>generic-helpers</artifactId>
<!--version>${cds.helper.version}</version-->
<version>0.0.19</version>
<version>0.0.20</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down

0 comments on commit 6577860

Please sign in to comment.