Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ public String getMessage() {
onboardingError.getError().getCode(), onboardingError.getError().message)
: "There was an error during the onboarding process.";
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
package com.dke.data.agrirouter.api.exception;

import com.dke.data.agrirouter.api.dto.revoke.RevokingError;

import java.util.Optional;

public class RevokingException extends RuntimeException {
private final String lastError;
private final RevokingError revokingError;

@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public RevokingException(Optional<RevokingError> lastError) {
this.revokingError = lastError.orElse(null);
}

public RevokingError getRevokingError() {
return revokingError;
}

public RevokingException(String lastError) {
this.lastError = lastError;
}
@Override
public String getMessage() {
return null != revokingError
? String.format(
"There was an error '%s' during the revoking, details were '%s'",
revokingError.getError().getCode(), revokingError.getError().message)
: "There was an error during the revoking process.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public RevokeResponse revoke(RevokeParameters revokeParameters) {
if (result.getKey() == RevokeResponse.SUCCESS.getKey()) {
return result;
} else {
String lastError = response.readEntity(String.class);
throw new RevokingException(lastError);
throw new RevokingException(getLastRevokingError(response.readEntity(String.class)));
}
} finally {
if (response != null) {
Expand Down