Implemented catching exceptions when decoding Base64 or parsing response (e.g. Baader Bank sometimes returns a HTML page instead of a FinTS response)

This commit is contained in:
dankito 2020-04-30 01:49:59 +02:00
parent abedd1d094
commit 1105dfbed0
1 changed files with 9 additions and 3 deletions

View File

@ -626,11 +626,17 @@ open class FinTsClient @JvmOverloads constructor(
if (webResponse.isSuccessful && responseBody != null) { if (webResponse.isSuccessful && responseBody != null) {
try {
val decodedResponse = decodeBase64Response(responseBody) val decodedResponse = decodeBase64Response(responseBody)
log.debug("Received message:\n${prettyPrintHbciMessage(decodedResponse)}") log.debug("Received message:\n${prettyPrintHbciMessage(decodedResponse)}")
return responseParser.parse(decodedResponse) return responseParser.parse(decodedResponse)
} catch (e: Exception) {
log.error("Could not decode responseBody:\r\n'$responseBody'", e)
return Response(false, exception = e)
}
} }
else { else {
log.error("Request to $bank (${bank.finTs3ServerAddress}) failed", webResponse.error) log.error("Request to $bank (${bank.finTs3ServerAddress}) failed", webResponse.error)