Trying to get inner exception for errorToShowToUser
This commit is contained in:
parent
7fbd6159ac
commit
ce58ef60ca
|
@ -11,12 +11,16 @@ import net.dankito.fints.model.BankData
|
||||||
import net.dankito.fints.model.CustomerData
|
import net.dankito.fints.model.CustomerData
|
||||||
import net.dankito.fints.response.client.FinTsClientResponse
|
import net.dankito.fints.response.client.FinTsClientResponse
|
||||||
import net.dankito.fints.response.segments.AccountType
|
import net.dankito.fints.response.segments.AccountType
|
||||||
|
import net.dankito.utils.exception.ExceptionHelper
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
|
||||||
open class fints4javaModelMapper {
|
open class fints4javaModelMapper {
|
||||||
|
|
||||||
|
|
||||||
|
private val exceptionHelper = ExceptionHelper()
|
||||||
|
|
||||||
|
|
||||||
open fun mapResponse(response: FinTsClientResponse): BankingClientResponse {
|
open fun mapResponse(response: FinTsClientResponse): BankingClientResponse {
|
||||||
return BankingClientResponse(response.isSuccessful, mapErrorToShowToUser(response), response.exception)
|
return BankingClientResponse(response.isSuccessful, mapErrorToShowToUser(response), response.exception)
|
||||||
}
|
}
|
||||||
|
@ -48,7 +52,9 @@ open class fints4javaModelMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun mapErrorToShowToUser(response: FinTsClientResponse): String? {
|
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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue