Global error handler

    1. HttpResponse<JsonError> error(HttpRequest request, Throwable e) {
    2. JsonError error = new JsonError("Bad Things Happened: " + e.getMessage()) (2)
    3. .link(Link.SELF, Link.of(request.getUri()))
    4. HttpResponse.<JsonError>serverError()
    5. .body(error) (3)

    Global status handler

    1. @Error(status = HttpStatus.NOT_FOUND)
    2. JsonError error = new JsonError("Person Not Found") (2)
    3. .link(Link.SELF, Link.of(request.getUri()));
    4. return HttpResponse.<JsonError>notFound()
    5. .body(error); (3)

    Global status handler

    1. @Error(status = HttpStatus.NOT_FOUND)
    2. fun notFound(request: HttpRequest<*>): HttpResponse<JsonError> { (1)
    3. .link(Link.SELF, Link.of(request.uri))
    4. return HttpResponse.notFound<JsonError>()
    5. .body(error) (3)