[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Global handler for invalid POSTed data
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Global handler for invalid POSTed data. |
Date: |
Mon, 16 Aug 2021 12:46:01 +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 8426fc7 Global handler for invalid POSTed data.
8426fc7 is described below
commit 8426fc73752b00fe6bebc6fcac359346225370cd
Author: MS <ms@taler.net>
AuthorDate: Sun Aug 15 23:45:32 2021 -1100
Global handler for invalid POSTed data.
---
.../main/kotlin/tech/libeufin/nexus/server/NexusServer.kt | 12 ++++++++++++
1 file changed, 12 insertions(+)
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 9e07004..4a0b7a3 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -25,6 +25,7 @@ import com.fasterxml.jackson.core.util.DefaultPrettyPrinter
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.core.JsonParseException
import com.fasterxml.jackson.databind.DeserializationFeature
+import com.fasterxml.jackson.databind.JsonMappingException
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.databind.exc.MismatchedInputException
import com.fasterxml.jackson.module.kotlin.KotlinModule
@@ -197,6 +198,17 @@ fun serverMain(host: String, port: Int) {
)
)
}
+ exception<JsonMappingException> { cause ->
+ logger.error("Exception while handling '${call.request.uri}'",
cause)
+ call.respond(
+ HttpStatusCode.BadRequest,
+ message = ErrorResponse(
+ code =
TalerErrorCode.TALER_EC_GENERIC_JSON_INVALID.code,
+ hint = "POSTed data was not valid",
+ detail = cause.message ?: "not given",
+ )
+ )
+ }
exception<UtilError> { cause ->
logger.error("Exception while handling '${call.request.uri}'",
cause)
call.respond(
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Global handler for invalid POSTed data.,
gnunet <=