diff options
author | Thomas <> | 2021-03-12 10:46:59 +0100 |
---|---|---|
committer | Thomas <> | 2021-03-12 10:46:59 +0100 |
commit | 7a1196805baad8fe055f92cfa8746c67684749b9 (patch) | |
tree | 7a48d0d78a446026c319211b2754a5b0ce80910d /connector/src/main/java/at/asitplus | |
parent | f1aa50e7284b982c8ffa48a1783bdb5600efa3d7 (diff) | |
download | National_eIDAS_Gateway-7a1196805baad8fe055f92cfa8746c67684749b9.tar.gz National_eIDAS_Gateway-7a1196805baad8fe055f92cfa8746c67684749b9.tar.bz2 National_eIDAS_Gateway-7a1196805baad8fe055f92cfa8746c67684749b9.zip |
update StatusMessageProvider for better distiguish between internal and external errorCodes
Diffstat (limited to 'connector/src/main/java/at/asitplus')
-rw-r--r-- | connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java index 073f7513..e83d9d49 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java @@ -28,6 +28,7 @@ import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -94,11 +95,10 @@ public class StatusMessageProvider implements IStatusMessenger { public String getResponseErrorCode(Throwable throwable) { String errorCode = IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC; if (throwable instanceof EaafException) { - errorCode = mapInternalErrorToExternalError(((EaafException) throwable).getErrorId()); + errorCode = ((EaafException) throwable).getErrorId(); } - // TODO: maybe more internal switches are required - + return errorCode; } @@ -120,7 +120,13 @@ public class StatusMessageProvider implements IStatusMessenger { } else { try { - return externalError.getString(intErrorCode); + if (StringUtils.isNotEmpty(intErrorCode)) { + return externalError.getString(intErrorCode); + + } else { + return IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC; + + } } catch (final MissingResourceException e2) { log.info(MessageFormat.format(ERROR_NO_EXTERNALERROR_CODE, new Object[] { intErrorCode })); |