Task reportToDiscord throw an exception if http request is not sucessful #22

Merged
quentinlegot merged 3 commits from dev into master 2023-07-26 23:25:16 +02:00
Showing only changes of commit bb9ae4d59b - Show all commits

View File

@ -42,7 +42,7 @@ public abstract class ReportDiscord extends DefaultTask {
.build(); .build();
try(Response response = client.newCall(request).execute()) { try(Response response = client.newCall(request).execute()) {
getLogger().info("report sent"); getLogger().info("report sent");
if(!(response.code() == 200)) { if(!response.isSuccessful()) {
throw new GradleException("Discord returned a " + response.code() + " code: " + response.message()); throw new GradleException("Discord returned a " + response.code() + " code: " + response.message());
} }
} }