more http logging

This commit is contained in:
Grahame Grieve 2022-02-04 07:26:47 +11:00
parent ee6dc981e2
commit 1979ec61d7
1 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,7 @@ public class SimpleHTTPClient {
} }
private static final int MAX_REDIRECTS = 5; private static final int MAX_REDIRECTS = 5;
private static int counter = 1;
public class HTTPResult { public class HTTPResult {
private int code; private int code;
@ -69,7 +70,9 @@ public class SimpleHTTPClient {
public void checkThrowException() throws IOException { public void checkThrowException() throws IOException {
if (code >= 300) { if (code >= 300) {
throw new IOException("Invalid HTTP response "+code+" from "+source+" ("+message+")"); String filename = Utilities.path("[tmp]", "fhir-http-"+(++counter)+".log");
TextFile.bytesToFile(content, filename);
throw new IOException("Invalid HTTP response "+code+" from "+source+" ("+message+") (content in "+filename+")");
} }
} }
} }