use of org.apache.flink.runtime.rest.messages.ErrorResponseBody in project flink by apache.
the class CheckpointConfigHandler method archiveJsonWithPath.
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody response;
try {
response = createCheckpointConfigInfo(graph);
} catch (RestHandlerException rhe) {
response = new ErrorResponseBody(rhe.getMessage());
}
String path = CheckpointConfigHeaders.getInstance().getTargetRestEndpointURL().replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singletonList(new ArchivedJson(path, response));
}
use of org.apache.flink.runtime.rest.messages.ErrorResponseBody in project flink by apache.
the class StaticFileServerHandler method respondAsLeader.
// ------------------------------------------------------------------------
// Responses to requests
// ------------------------------------------------------------------------
@Override
protected void respondAsLeader(ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest, T gateway) throws Exception {
final HttpRequest request = routedRequest.getRequest();
final String requestPath;
// make sure we request the "index.html" in case there is a directory request
if (routedRequest.getPath().endsWith("/")) {
requestPath = routedRequest.getPath() + "index.html";
} else {
requestPath = routedRequest.getPath();
}
try {
respondToRequest(channelHandlerContext, request, requestPath);
} catch (RestHandlerException rhe) {
HandlerUtils.sendErrorResponse(channelHandlerContext, routedRequest.getRequest(), new ErrorResponseBody(rhe.getMessage()), rhe.getHttpResponseStatus(), responseHeaders);
}
}
use of org.apache.flink.runtime.rest.messages.ErrorResponseBody in project flink by apache.
the class StaticFileServerHandler method exceptionCaught.
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (ctx.channel().isActive()) {
logger.error("Caught exception", cause);
HandlerUtils.sendErrorResponse(ctx, false, new ErrorResponseBody("Internal server error."), INTERNAL_SERVER_ERROR, Collections.emptyMap());
}
}
Aggregations