Search in sources :

Example 1 with ViewNotFoundException

use of com.couchbase.client.core.error.ViewNotFoundException 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);
    });
}
Also used : CouchbaseException(com.couchbase.client.core.error.CouchbaseException) ResponseStatus(com.couchbase.client.core.msg.ResponseStatus) ViewErrorContext(com.couchbase.client.core.error.context.ViewErrorContext) ViewNotFoundException(com.couchbase.client.core.error.ViewNotFoundException)

Aggregations

CouchbaseException (com.couchbase.client.core.error.CouchbaseException)1 ViewNotFoundException (com.couchbase.client.core.error.ViewNotFoundException)1 ViewErrorContext (com.couchbase.client.core.error.context.ViewErrorContext)1 ResponseStatus (com.couchbase.client.core.msg.ResponseStatus)1