Skip to content

Commit

Permalink
Client: Silence URI exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed Jan 20, 2025
1 parent b6761ac commit a1ca64a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package co.casterlabs.log_strudel;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpClient.Redirect;
import java.net.http.HttpRequest;
Expand All @@ -22,9 +23,11 @@ public class LogStrudel {

public void publish(@NonNull Line line) {
try {
URI uri = new URI(this.lsUrl + "/lines");

httpClient.sendAsync(
HttpRequest.newBuilder()
.uri(URI.create(this.lsUrl + "/lines"))
.uri(uri)
.header("Authorization", "Bearer " + this.lsToken)
.header("Content-Type", "application/json")
.POST(
Expand All @@ -35,6 +38,8 @@ public void publish(@NonNull Line line) {
.build(),
BodyHandlers.discarding()
);
} catch (URISyntaxException ignored) {
// NOOP
} catch (Throwable t) {
t.printStackTrace();
}
Expand Down

0 comments on commit a1ca64a

Please sign in to comment.