本文整理匯總了Java中org.elasticsearch.rest.RestStatus.NOT_FOUND屬性的典型用法代碼示例。如果您正苦於以下問題:Java RestStatus.NOT_FOUND屬性的具體用法?Java RestStatus.NOT_FOUND怎麽用?Java RestStatus.NOT_FOUND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.elasticsearch.rest.RestStatus
的用法示例。
在下文中一共展示了RestStatus.NOT_FOUND屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: status
@Override
public RestStatus status() {
return isFound() ? RestStatus.OK : RestStatus.NOT_FOUND;
}
示例2: status
@Override
public final RestStatus status() {
return RestStatus.NOT_FOUND;
}
示例3: status
@Override
public RestStatus status() {
return RestStatus.NOT_FOUND;
}
示例4: status
@Override
public RestStatus status() {
return result == Result.DELETED ? super.status() : RestStatus.NOT_FOUND;
}
示例5: buildSQLActionException
/**
* Create a {@link io.crate.action.sql.SQLActionException} out of a {@link java.lang.Throwable}.
* If concrete {@link org.elasticsearch.ElasticsearchException} is found, first transform it
* to a {@link io.crate.exceptions.CrateException}
*/
private SQLActionException buildSQLActionException(Throwable e) {
logger.error("errors while processing sql", e);
if (e instanceof SQLActionException) {
return (SQLActionException) e;
}
e = esToCrateException(e);
int errorCode = 5000;
RestStatus restStatus = RestStatus.INTERNAL_SERVER_ERROR;
if (e instanceof CrateException) {
CrateException crateException = (CrateException) e;
if (e instanceof ValidationException) {
errorCode = 4000 + crateException.errorCode();
restStatus = RestStatus.BAD_REQUEST;
} else if (e instanceof NoPermissionException) {
errorCode = 4000 + crateException.errorCode();
restStatus = RestStatus.UNAUTHORIZED;
e.setStackTrace(new StackTraceElement[0]);
} else if (e instanceof ForbiddenException) {
errorCode = 4030 + crateException.errorCode();
restStatus = RestStatus.FORBIDDEN;
} else if (e instanceof ResourceUnknownException) {
errorCode = 4040 + crateException.errorCode();
restStatus = RestStatus.NOT_FOUND;
} else if (e instanceof ConflictException) {
errorCode = 4090 + crateException.errorCode();
restStatus = RestStatus.CONFLICT;
} else if (e instanceof UnhandledServerException) {
errorCode = 5000 + crateException.errorCode();
}
} else if (e instanceof ParsingException) {
errorCode = 4000;
restStatus = RestStatus.BAD_REQUEST;
} else if (e instanceof MapperParsingException) {
errorCode = 4000;
restStatus = RestStatus.BAD_REQUEST;
}
String message = e.getMessage();
if (message == null) {
if (e instanceof CrateException && e.getCause() != null) {
e = e.getCause(); // use cause because it contains a more meaningful error in most cases
}
StackTraceElement[] stackTraceElements = e.getStackTrace();
if (stackTraceElements.length > 0) {
message = String.format(Locale.ENGLISH, "%s in %s", e.getClass().getSimpleName(), stackTraceElements[0]);
} else {
message = "Error in " + e.getClass().getSimpleName();
}
} else {
message = e.getClass().getSimpleName() + ": " + message;
}
return new SQLActionException(message, errorCode, restStatus, e.getStackTrace());
}