0

How can we implement a custom exception mapper in the Javalin frame work? The main issue I am having with the default one is that it includes a type field in its json responses that identifies it as a javalin exception. I don't wish to expose this information. It looks as follows:

{

    "title": "Internal server error.",

    "status": 500,

    "type": "https://javalin.io/documentation#error-responses",

    .....

}

The HttpResponseExceptionMapper doesn't seem to be an interface or anything that can be overridden. So I am at a loss, does anyone have any ideas?

Peter McKinney
  • 463
  • 3
  • 13
  • Can you show us the code which is generating this JSON? I may have misunderstood the question, but I would have expected you can use `app.exception(Exception.class, (e, ctx) -> { ...build your JSON response here... }` or `app.error(500, ctx -> { ... }`. – andrewJames Dec 08 '22 at 02:25

0 Answers0