use of akka.http.javadsl.server.ExceptionHandler in project mantis by Netflix.
the class JobStatusRoute method createRoute.
public Route createRoute(Function<Route, Route> routeFilter) {
logger.info("creating routes");
final ExceptionHandler jsonExceptionHandler = ExceptionHandler.newBuilder().match(IOException.class, x -> {
logger.error("got exception", x);
return complete(StatusCodes.BAD_REQUEST, "caught exception " + x.getMessage());
}).build();
return respondWithHeaders(DEFAULT_RESPONSE_HEADERS, () -> handleExceptions(jsonExceptionHandler, () -> routeFilter.apply(getJobStatusRoutes())));
}
use of akka.http.javadsl.server.ExceptionHandler in project mantis by Netflix.
the class AgentClusterRoute method createRoute.
public Route createRoute(Function<Route, Route> routeFilter) {
logger.info("creating routes");
final ExceptionHandler jsonExceptionHandler = ExceptionHandler.newBuilder().match(Exception.class, x -> {
logger.error("got exception", x);
return complete(StatusCodes.INTERNAL_SERVER_ERROR, "{\"error\": \"" + x.getMessage() + "\"}");
}).build();
return respondWithHeaders(DEFAULT_RESPONSE_HEADERS, () -> handleExceptions(jsonExceptionHandler, () -> routeFilter.apply(agentClusterRoutes())));
}
Aggregations