use of akka.http.javadsl.server.ExceptionHandler in project mantis by Netflix.
the class JobClusterRoute method createRoute.
public Route createRoute(Function<Route, Route> routeFilter) {
logger.info("creating routes");
final ExceptionHandler genericExceptionHandler = ExceptionHandler.newBuilder().match(Exception.class, e -> {
logger.error("got exception", e);
return complete(StatusCodes.INTERNAL_SERVER_ERROR, "{\"error\": \"" + e.getMessage() + "\"}");
}).build();
return respondWithHeaders(DEFAULT_RESPONSE_HEADERS, () -> handleExceptions(genericExceptionHandler, () -> routeFilter.apply(getJobClusterRoutes())));
}
use of akka.http.javadsl.server.ExceptionHandler in project mantis by Netflix.
the class JobRoute method createRoute.
public Route createRoute(Function<Route, Route> routeFilter) {
logger.info("creating routes");
final ExceptionHandler genericExceptionHandler = 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(genericExceptionHandler, () -> routeFilter.apply(getJobRoutes())));
}
use of akka.http.javadsl.server.ExceptionHandler in project mantis by Netflix.
the class MasterDescriptionRoute 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(getMasterDescRoute())));
}
use of akka.http.javadsl.server.ExceptionHandler in project mantis by Netflix.
the class JobDiscoveryRoute 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(getJobDiscoveryRoutes())));
}
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())));
}
Aggregations