summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main
diff options
context:
space:
mode:
authorThomas <>2023-12-21 10:35:44 +0100
committerThomas <>2023-12-21 10:35:44 +0100
commite56f8e8d99e6ccf956faeb720b8a943dfa87639e (patch)
treebdbb71515d864fce9a6f4cbf0487cd3ffe94f297 /eaaf_core/src/main
parent36b0bcd879afa5ec3bd5f3dad1c0b63902adc79d (diff)
downloadEAAF-Components-e56f8e8d99e6ccf956faeb720b8a943dfa87639e.tar.gz
EAAF-Components-e56f8e8d99e6ccf956faeb720b8a943dfa87639e.tar.bz2
EAAF-Components-e56f8e8d99e6ccf956faeb720b8a943dfa87639e.zip
feat(errorhandling): update configuration-model to exclude stake-trace logging
Diffstat (limited to 'eaaf_core/src/main')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/ErrorConfig.java9
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java2
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/DefaultErrorService.java4
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java7
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java50
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/TicketErrorService.java5
6 files changed, 60 insertions, 17 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/ErrorConfig.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/ErrorConfig.java
index b9cacb1c..5f1d0976 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/ErrorConfig.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/ErrorConfig.java
@@ -2,6 +2,9 @@ package at.gv.egiz.eaaf.core.impl.data;
import java.util.List;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+
import at.gv.egiz.eaaf.core.impl.idp.auth.services.IErrorService.ActionType;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -44,6 +47,12 @@ public class ErrorConfig {
@Builder.Default
private Boolean useInternalAsExternal = false;
+ @Getter
+ @Setter
+ @Builder.Default
+ @JsonSetter(nulls = Nulls.SKIP)
+ private Boolean writeThrowable = true;
+
/**
* Get type of error-handling flow.
*
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
index 4279e427..78653cf8 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
@@ -378,7 +378,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
final Throwable taskCause = cause.getCause();
if (taskCause != null && taskCause instanceof EaafException) {
final EaafException moaTaskCause = (EaafException) taskCause;
- log.info(taskCause.getMessage(), taskCause);
+ log.info(taskCause.getMessage());
throw moaTaskCause;
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/DefaultErrorService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/DefaultErrorService.java
index ea045c8d..e8e22b8f 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/DefaultErrorService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/DefaultErrorService.java
@@ -104,6 +104,10 @@ public class DefaultErrorService implements IErrorService {
@Getter
private LogLevel logLevel;
+ @Getter
+ @Builder.Default
+ private boolean writeThrowable = true;
+
@Override
public Map<String, String> getAdditionalGuiModelElements() {
return Collections.emptyMap();
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java
index ef04861d..657ebb4d 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java
@@ -157,6 +157,13 @@ public interface IErrorService {
Throwable getThrowable();
/**
+ * Flag that indicates if stake-trace should be logged for that error.
+ *
+ * @return <code>true</code> in case of log stake-trace, otherwise false
+ */
+ boolean isWriteThrowable();
+
+ /**
* Get the log-level for this internal errorId.
*
* @return Level to Log the error
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
index 84753408..b1f45801 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
@@ -328,29 +328,47 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
}
private void logExceptionToTechnicalLog(IHandleData errorData) {
- // In case of a TaskExecutionException, which is only a container for
- // process-errors,
- // extract internal exception
+ if (errorData.isWriteThrowable()) {
+ if (!(errorData.getThrowable() instanceof EaafException)
+ || LogLevel.ERROR.equals(errorData.getLogLevel())) {
+ log.error(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
- // Log exception
- if (!(errorData.getThrowable() instanceof EaafException)
- || LogLevel.ERROR.equals(errorData.getLogLevel())) {
- log.error(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
+ } else if (LogLevel.WARN.equals(errorData.getLogLevel())) {
+ log.warn(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
- } else if (LogLevel.WARN.equals(errorData.getLogLevel())) {
- log.warn(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
+ } else if (LogLevel.INFO.equals(errorData.getLogLevel())) {
+ log.info(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
- } else if (LogLevel.INFO.equals(errorData.getLogLevel())) {
- log.info(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
+ } else if (LogLevel.DEBUG.equals(errorData.getLogLevel())) {
+ log.debug(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
- } else if (LogLevel.DEBUG.equals(errorData.getLogLevel())) {
- log.debug(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
+ } else {
+ log.warn("Get unsupported LogLevelType: {}. Use {} as default",
+ errorData.getLogLevel(), LogLevel.ERROR);
+ log.error(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
+
+ }
} else {
- log.warn("Get unsupported LogLevelType: {}. Use {} as default",
- errorData.getLogLevel(), LogLevel.ERROR);
- log.error(errorData.getPreFormatedErrorMessage(), errorData.getThrowable());
+ if (!(errorData.getThrowable() instanceof EaafException)
+ || LogLevel.ERROR.equals(errorData.getLogLevel())) {
+ log.error(errorData.getPreFormatedErrorMessage());
+
+ } else if (LogLevel.WARN.equals(errorData.getLogLevel())) {
+ log.warn(errorData.getPreFormatedErrorMessage());
+
+ } else if (LogLevel.INFO.equals(errorData.getLogLevel())) {
+ log.info(errorData.getPreFormatedErrorMessage());
+ } else if (LogLevel.DEBUG.equals(errorData.getLogLevel())) {
+ log.debug(errorData.getPreFormatedErrorMessage());
+
+ } else {
+ log.warn("Get unsupported LogLevelType: {}. Use {} as default",
+ errorData.getLogLevel(), LogLevel.ERROR);
+ log.error(errorData.getPreFormatedErrorMessage());
+
+ }
}
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/TicketErrorService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/TicketErrorService.java
index e8d6cb9a..8f32dcb0 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/TicketErrorService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/TicketErrorService.java
@@ -85,6 +85,7 @@ public abstract class TicketErrorService implements IErrorService {
return HandleData.builder()
.throwable(throwable)
+ .writeThrowable(errorFlowConfig.getWriteThrowable())
.internalErrorCode(internalErrorId)
.actionType(errorHandlingFlow)
.logLevel(LogLevel.fromString(errorFlowConfig.getLogLevel()))
@@ -261,6 +262,10 @@ public abstract class TicketErrorService implements IErrorService {
private LogLevel logLevel;
@Getter
+ @Builder.Default
+ private boolean writeThrowable = true;
+
+ @Getter
private Map<String, String> additionalGuiModelElements;
public String getPreFormatedErrorMessage() {