use of com.couchbase.client.core.error.context.ViewErrorContext in project couchbase-jvm-clients by couchbase.
the class ViewChunkResponseParser method error.
@Override
public Optional<CouchbaseException> error() {
return error.map(e -> {
int httpStatus = responseHeader().status().code();
ResponseStatus responseStatus = HttpProtocol.decodeStatus(responseHeader().status());
ViewErrorContext errorContext = new ViewErrorContext(responseStatus, requestContext(), e, httpStatus);
if (responseStatus == ResponseStatus.NOT_FOUND || e.error().equals("not_found") || e.reason().contains("not_found")) {
return new ViewNotFoundException(errorContext);
}
return new CouchbaseException("Unknown view error: " + e.toString(), errorContext);
});
}
Aggregations