gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 01/03: Nexus error handling.


From: gnunet
Subject: [libeufin] 01/03: Nexus error handling.
Date: Fri, 06 Jan 2023 19:09:42 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

commit 870d3e29f78397f73a9515febfa1088ebb121f3f
Author: MS <ms@taler.net>
AuthorDate: Fri Jan 6 18:44:18 2023 +0100

    Nexus error handling.
    
    Log, and respond the full EBICS report text
    (received from the bank) to the client.
---
 nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt | 6 +++---
 util/src/main/kotlin/Ebics.kt                                  | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt
index 6d2ce4de..136bf7e8 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt
@@ -255,9 +255,9 @@ suspend fun doEbicsUploadTransaction(
                  * bank rejecting the operation instead of it
                  * detecting the problem.
                  */
-                HttpStatusCode.InternalServerError,
-                "Unexpected EBICS technical return code: 
${txResp.technicalReturnCode}",
-                txResp.technicalReturnCode
+                httpStatusCode = HttpStatusCode.InternalServerError,
+                reason = txResp.reportText,
+                ebicsTechnicalCode = txResp.technicalReturnCode
             )
         }
     }
diff --git a/util/src/main/kotlin/Ebics.kt b/util/src/main/kotlin/Ebics.kt
index 405c2fcb..6549dea5 100644
--- a/util/src/main/kotlin/Ebics.kt
+++ b/util/src/main/kotlin/Ebics.kt
@@ -47,7 +47,7 @@ data class EbicsProtocolError(
     val httpStatusCode: HttpStatusCode,
     val reason: String,
     /**
-     * This error type is also used when Nexus finds itself
+     * This class is also used when Nexus finds itself
      * in an inconsistent state, without interacting with the
      * bank.  In this case, the EBICS code below can be left
      * null.
@@ -386,6 +386,7 @@ data class EbicsResponseContent(
     val orderDataEncChunk: String?,
     val technicalReturnCode: EbicsReturnCode,
     val bankReturnCode: EbicsReturnCode,
+    val reportText: String,
     val segmentNumber: Int?,
     // Only present in init phase
     val numSegments: Int?
@@ -496,6 +497,8 @@ fun parseAndValidateEbicsResponse(
     val techReturnCodeStr = resp.value.header.mutable.returnCode
     val techReturnCode = EbicsReturnCode.lookup(techReturnCodeStr)
 
+    val reportText = resp.value.header.mutable.reportText
+
     val daeXml = resp.value.body.dataTransfer?.dataEncryptionInfo
     val dataEncryptionInfo = if (daeXml == null) {
         null
@@ -507,6 +510,7 @@ fun parseAndValidateEbicsResponse(
         transactionID = resp.value.header._static.transactionID,
         bankReturnCode = bankReturnCode,
         technicalReturnCode = techReturnCode,
+        reportText = reportText,
         orderDataEncChunk = resp.value.body.dataTransfer?.orderData?.value,
         dataEncryptionInfo = dataEncryptionInfo,
         numSegments = resp.value.header._static.numSegments?.toInt(),

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]