gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: error messages


From: gnunet
Subject: [libeufin] branch master updated: error messages
Date: Wed, 05 Apr 2023 14:05:08 +0200

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

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 7bfe53c6 error messages
7bfe53c6 is described below

commit 7bfe53c69a5c7a1335f9fcb431f430043bc1c793
Author: MS <ms@taler.net>
AuthorDate: Wed Apr 5 14:05:00 2023 +0200

    error messages
---
 .../kotlin/tech/libeufin/sandbox/CircuitApi.kt     | 40 +++++++++++++---------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
index b04af23d..d9008fb6 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
@@ -193,6 +193,13 @@ fun isTanChannelSupported(tanChannel: String): Boolean {
 var EMAIL_TAN_CMD: String? = null
 var SMS_TAN_CMD: String? = null
 
+// Convenience class to collect TAN data.
+private data class TanData(
+    val cmd: String,
+    val address: String,
+    val msg: String
+)
+
 /**
  * Runs the command and returns True/False if that succeeded/failed.
  * A failed command causes "500 Internal Server Error" to be responded
@@ -535,7 +542,13 @@ fun circuitApi(circuitRoute: Route) {
                 )
             }
         }
-        // Send the TAN.
+        fun failCashout(
+            msg: String,
+            op: CashoutOperationEntity,
+            keep: Boolean = true
+        ) {
+
+        }
         when (tanChannel) {
             SupportedTanChannels.EMAIL.name -> {
                 val isSuccessful = try {
@@ -551,15 +564,12 @@ fun circuitApi(circuitRoute: Route) {
                         message = op.tan
                     )
                 } catch (e: Exception) {
-                    throw internalServerError(
-                        "Sending the e-mail TAN failed for ${customer.email}." 
+
-                                "  The command threw this exception: 
${e.message}"
-                    )
+                    logger.error("Sending the e-mail TAN to ${customer.email} 
was impossible." +
+                            "  Reason: ${e.message}")
+                    throw internalServerError("Could not send the e-mail TAN.")
                 }
                 if (!isSuccessful)
-                    throw internalServerError(
-                        "E-mail TAN command failed for ${customer.email}."
-                    )
+                    throw internalServerError("E-mail TAN command failed.")
             }
             SupportedTanChannels.SMS.name -> {
                 val isSuccessful = try {
@@ -577,21 +587,19 @@ fun circuitApi(circuitRoute: Route) {
                     )
 
                 } catch (e: Exception) {
-                    throw internalServerError(
-                        "Sending the SMS TAN failed for ${customer.phone}." +
-                                " The command threw this exception: 
${e.message}"
-                    )
+                    logger.error("Sending the SMS TAN to ${customer.phone} was 
impossible." +
+                            "  Reason: ${e.message}")
+                    throw internalServerError("Could not send the SMS TAN.")
                 }
                 if (!isSuccessful)
-                    throw internalServerError(
-                        "SMS TAN command failed for ${customer.phone}.")
+                    throw internalServerError("SMS TAN command failed.")
             }
             SupportedTanChannels.FILE.name -> {
                 try {
                     File(LIBEUFIN_TAN_TMP_FILE).writeText(op.tan)
                 } catch (e: Exception) {
-                    logger.error(e.message)
-                    throw internalServerError("File TAN failed: could not 
write to $LIBEUFIN_TAN_TMP_FILE")
+                    logger.error("Could not write to $LIBEUFIN_TAN_TMP_FILE.  
Reason: ${e.message}")
+                    throw internalServerError("File TAN failed.")
                 }
             }
             else ->

-- 
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]