|
| 1 | +/* |
| 2 | + * Copyright 2018 Google |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +#ifndef FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_ERRORS_H_ |
| 18 | +#define FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_ERRORS_H_ |
| 19 | + |
| 20 | +namespace firebase { |
| 21 | +namespace firestore { |
| 22 | + |
| 23 | +/** |
| 24 | + * Error codes used by Cloud Firestore. |
| 25 | + * |
| 26 | + * The codes are in sync with the Firestore iOS client SDK header file |
| 27 | + * FIRFirestoreErrors.h. |
| 28 | + */ |
| 29 | +enum FirestoreErrorCode { |
| 30 | + /** |
| 31 | + * The operation completed successfully. NSError objects will never have a |
| 32 | + * code with this value. |
| 33 | + */ |
| 34 | + Ok = 0, |
| 35 | + |
| 36 | + /** The operation was cancelled (typically by the caller). */ |
| 37 | + Cancelled = 1, |
| 38 | + |
| 39 | + /** Unknown error or an error from a different error domain. */ |
| 40 | + Unknown = 2, |
| 41 | + |
| 42 | + /** |
| 43 | + * Client specified an invalid argument. Note that this differs from |
| 44 | + * FailedPrecondition. InvalidArgument indicates arguments that are |
| 45 | + * problematic regardless of the state of the system (e.g., an invalid field |
| 46 | + * name). |
| 47 | + */ |
| 48 | + InvalidArgument = 3, |
| 49 | + |
| 50 | + /** |
| 51 | + * Deadline expired before operation could complete. For operations that |
| 52 | + * change the state of the system, this error may be returned even if the |
| 53 | + * operation has completed successfully. For example, a successful response |
| 54 | + * from a server could have been delayed long enough for the deadline to |
| 55 | + * expire. |
| 56 | + */ |
| 57 | + DeadlineExceeded = 4, |
| 58 | + |
| 59 | + /** Some requested document was not found. */ |
| 60 | + NotFound = 5, |
| 61 | + |
| 62 | + /** Some document that we attempted to create already exists. */ |
| 63 | + AlreadyExists = 6, |
| 64 | + |
| 65 | + /** The caller does not have permission to execute the specified operation. */ |
| 66 | + PermissionDenied = 7, |
| 67 | + |
| 68 | + /** |
| 69 | + * Some resource has been exhausted, perhaps a per-user quota, or perhaps the |
| 70 | + * entire file system is out of space. |
| 71 | + */ |
| 72 | + ResourceExhausted = 8, |
| 73 | + |
| 74 | + /** |
| 75 | + * Operation was rejected because the system is not in a state required for |
| 76 | + * the operation's execution. |
| 77 | + */ |
| 78 | + FailedPrecondition = 9, |
| 79 | + |
| 80 | + /** |
| 81 | + * The operation was aborted, typically due to a concurrency issue like |
| 82 | + * transaction aborts, etc. |
| 83 | + */ |
| 84 | + Aborted = 10, |
| 85 | + |
| 86 | + /** Operation was attempted past the valid range. */ |
| 87 | + OutOfRange = 11, |
| 88 | + |
| 89 | + /** Operation is not implemented or not supported/enabled. */ |
| 90 | + Unimplemented = 12, |
| 91 | + |
| 92 | + /** |
| 93 | + * Internal errors. Means some invariants expected by underlying system has |
| 94 | + * been broken. If you see one of these errors, something is very broken. |
| 95 | + */ |
| 96 | + Internal = 13, |
| 97 | + |
| 98 | + /** |
| 99 | + * The service is currently unavailable. This is a most likely a transient |
| 100 | + * condition and may be corrected by retrying with a backoff. |
| 101 | + */ |
| 102 | + Unavailable = 14, |
| 103 | + |
| 104 | + /** Unrecoverable data loss or corruption. */ |
| 105 | + DataLoss = 15, |
| 106 | + |
| 107 | + /** The request does not have valid authentication credentials for the |
| 108 | + operation. */ |
| 109 | + Unauthenticated = 16 |
| 110 | +}; |
| 111 | + |
| 112 | +} // namespace firestore |
| 113 | +} // namespace firebase |
| 114 | + |
| 115 | +#endif // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_ERRORS_H_ |
0 commit comments