Situation
I have Action in my controller that accepts JObject in parameters.
public IActionResult Test(JObject request)
For development environment requests will be sent as simple json with data using "application/json" content type.
But for production environment we will use JWE to protect our data. So request will be JWE token and content type will be "application/jose".
I create my custom InputFormatter so I can easily read this token, decrypt it and retrieve my JObject to pass it to controllers action. Everything till this moment was ok but I faced problem of sending error message if something wrong with token (e.g. couldn't decrypt because pass phrase is wrong or the token itself is corrupted). InputFormatterResult.Failure() doesn't accept any parameters.
So I want to understand where should I do this.
HttpRequest -> something -> Action of controller