1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.search
;
5 import com
.google
.appengine
.api
.search
.SearchServicePb
.SearchServiceError
.ErrorCode
;
8 * Status code returned by various index operations.
10 public enum StatusCode
{
12 * The last operation was successfully completed.
17 * The last operation failed due to invalid, user specified parameters.
22 * The last operation failed due to a transient backend error.
27 * The last operation failed due to a internal backend error.
32 * The last operation failed due to user not having permission.
34 PERMISSION_DENIED_ERROR
;
37 * Provides a mapping from protocol buffer enum to user API enum.
39 * @param code the proto buffer enum
40 * @return the corresponding user API enum
42 static StatusCode
fromErrorCode(ErrorCode code
) {
44 case OK
: return StatusCode
.OK
;
45 case INVALID_REQUEST
: return StatusCode
.INVALID_REQUEST
;
46 case TRANSIENT_ERROR
: return StatusCode
.TRANSIENT_ERROR
;
47 case INTERNAL_ERROR
: return StatusCode
.INTERNAL_ERROR
;
48 case PERMISSION_DENIED
: return StatusCode
.PERMISSION_DENIED_ERROR
;
50 throw new IllegalArgumentException("Failed to convert error code to status enum " + code
);