diff --git a/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt b/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt index 86706d2f..d49b748f 100644 --- a/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt +++ b/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt @@ -11,12 +11,16 @@ import net.dankito.fints.model.BankData import net.dankito.fints.model.CustomerData import net.dankito.fints.response.client.FinTsClientResponse import net.dankito.fints.response.segments.AccountType +import net.dankito.utils.exception.ExceptionHelper import java.math.BigDecimal open class fints4javaModelMapper { + private val exceptionHelper = ExceptionHelper() + + open fun mapResponse(response: FinTsClientResponse): BankingClientResponse { return BankingClientResponse(response.isSuccessful, mapErrorToShowToUser(response), response.exception) } @@ -48,7 +52,9 @@ open class fints4javaModelMapper { } open fun mapErrorToShowToUser(response: FinTsClientResponse): String? { - return response.exception?.localizedMessage ?: response.errorsToShowToUser.joinToString("\n") + val innerException = response.exception?.let { exception -> exceptionHelper.getInnerException(exception) } + + return innerException?.localizedMessage ?: response.errorsToShowToUser.joinToString("\n") }