ASP.NET Core provides a ProblemDetails type that can be returned in an ActionResult<'T>. What's the advised way of returning a result via Giraffe using this type? Can this be returned directly using Giraffe's json function? cc @ditadi
Hi @panesofglass, I do not think it is actually core platform but MVC with provides ProblemDetails type, if that is the case it would be outside scope of Giraffe.
Hi, the ProblemDetails is an MVC specific type indeed. However, there's nothing stopping you from creating your own record type and return problem details objects via Giraffe. If you want to couple it with exception handling then you can put this into the Giraffe error handler or you can use an existing ASP.NET Core middleware which already does that for you when you set it up for your custom exception messages, e.g.: https://lurumad.github.io/problem-details-an-standard-way-for-specifying-errors-in-http-api-responses-asp.net-core
Most helpful comment
Hi, the
ProblemDetailsis an MVC specific type indeed. However, there's nothing stopping you from creating your own record type and return problem details objects via Giraffe. If you want to couple it with exception handling then you can put this into the Giraffe error handler or you can use an existing ASP.NET Core middleware which already does that for you when you set it up for your custom exception messages, e.g.: https://lurumad.github.io/problem-details-an-standard-way-for-specifying-errors-in-http-api-responses-asp.net-core