SEBSERV-417 improved error and waning handling and logging

This commit is contained in:
anhefti 2024-06-06 13:59:21 +02:00
parent 07391430c4
commit dc98f451fa
2 changed files with 3 additions and 3 deletions

View file

@ -563,13 +563,13 @@ public abstract class MoodleUtils {
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public static final class FullConnectionApplyResponse { public static final class FullConnectionApplyResponse {
@JsonProperty("success") @JsonProperty("success")
public final int success; public final boolean success;
@JsonProperty("warnings") @JsonProperty("warnings")
public final Collection<Warning> warnings; public final Collection<Warning> warnings;
@JsonCreator @JsonCreator
public FullConnectionApplyResponse( public FullConnectionApplyResponse(
@JsonProperty("success") final int success, @JsonProperty("success") final boolean success,
@JsonProperty("warnings") final Collection<Warning> warnings) { @JsonProperty("warnings") final Collection<Warning> warnings) {
this.success = success; this.success = success;

View file

@ -137,7 +137,7 @@ public class MoodlePluginFullIntegration implements FullLmsIntegrationAPI {
response, response,
MoodleUtils.FullConnectionApplyResponse.class); MoodleUtils.FullConnectionApplyResponse.class);
if (fullConnectionApplyResponse.success == 0 && !fullConnectionApplyResponse.warnings.isEmpty()) { if (!fullConnectionApplyResponse.success && !fullConnectionApplyResponse.warnings.isEmpty()) {
fullConnectionApplyResponse.warnings.stream() fullConnectionApplyResponse.warnings.stream()
.filter(w -> Objects.equals(w.warningcode, "connectiondoesntmatch")) .filter(w -> Objects.equals(w.warningcode, "connectiondoesntmatch"))
.findFirst() .findFirst()