summaryrefslogtreecommitdiff
path: root/nexus
diff options
context:
space:
mode:
authorms <ms@taler.net>2021-08-09 20:58:07 +0200
committerms <ms@taler.net>2021-08-09 20:58:07 +0200
commit0376eecc51832a2413acbdb122eaa4175ecf0382 (patch)
tree988ecba9e789395ce0fec96938b4655bfb7e8769 /nexus
parented7416917e4094eb66d3829acf7fe8a9878d9c54 (diff)
downloadlibeufin-0376eecc51832a2413acbdb122eaa4175ecf0382.tar.gz
libeufin-0376eecc51832a2413acbdb122eaa4175ecf0382.tar.bz2
libeufin-0376eecc51832a2413acbdb122eaa4175ecf0382.zip
Fix number parsing.
Sanity-checking input (number-)strings with RegEx.
Diffstat (limited to 'nexus')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index 83e77f36..9e07004c 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -19,6 +19,7 @@
package tech.libeufin.nexus.server
+import UtilError
import com.fasterxml.jackson.core.util.DefaultIndenter
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter
import com.fasterxml.jackson.databind.JsonNode
@@ -196,6 +197,17 @@ fun serverMain(host: String, port: Int) {
)
)
}
+ exception<UtilError> { cause ->
+ logger.error("Exception while handling '${call.request.uri}'", cause)
+ call.respond(
+ cause.statusCode,
+ message = ErrorResponse(
+ code = cause.ec?.code ?: TalerErrorCode.TALER_EC_NONE.code,
+ hint = "see detail",
+ detail = cause.reason,
+ )
+ )
+ }
exception<EbicsProtocolError> { cause ->
logger.error("Caught exception while handling '${call.request.uri}' (${cause.reason})")
call.respond(