Trying to fix report discord task #23

Merged
quentinlegot merged 10 commits from patch-report1 into dev 2023-07-26 23:46:29 +02:00
Showing only changes of commit 662206f32f - Show all commits

View File

@ -2,6 +2,7 @@ package fr.altarik;
import okhttp3.*; import okhttp3.*;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.provider.Property; import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.TaskAction;
@ -41,6 +42,9 @@ 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.isSuccessful()) {
throw new GradleException("Discord returned a " + response.code() + " code: " + response.message());
}
} }
} }