FIRError.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Copyright 2017 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. NS_ASSUME_NONNULL_BEGIN
  16. // The error domain for codes in the FIRFunctionsErrorCode enum.
  17. FOUNDATION_EXPORT NSString *const FIRFunctionsErrorDomain NS_SWIFT_NAME(FunctionsErrorDomain);
  18. // The key for finding error details in the NSError userInfo.
  19. FOUNDATION_EXPORT NSString *const FIRFunctionsErrorDetailsKey
  20. NS_SWIFT_NAME(FunctionsErrorDetailsKey);
  21. /**
  22. * The set of error status codes that can be returned from a Callable HTTPS tigger. These are the
  23. * canonical error codes for Google APIs, as documented here:
  24. * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto#L26
  25. */
  26. typedef NS_ENUM(NSInteger, FIRFunctionsErrorCode) {
  27. /** The operation completed successfully. */
  28. FIRFunctionsErrorCodeOK = 0,
  29. /** The operation was cancelled (typically by the caller). */
  30. FIRFunctionsErrorCodeCancelled = 1,
  31. /** Unknown error or an error from a different error domain. */
  32. FIRFunctionsErrorCodeUnknown = 2,
  33. /**
  34. * Client specified an invalid argument. Note that this differs from `FailedPrecondition`.
  35. * `InvalidArgument` indicates arguments that are problematic regardless of the state of the
  36. * system (e.g., an invalid field name).
  37. */
  38. FIRFunctionsErrorCodeInvalidArgument = 3,
  39. /**
  40. * Deadline expired before operation could complete. For operations that change the state of the
  41. * system, this error may be returned even if the operation has completed successfully. For
  42. * example, a successful response from a server could have been delayed long enough for the
  43. * deadline to expire.
  44. */
  45. FIRFunctionsErrorCodeDeadlineExceeded = 4,
  46. /** Some requested document was not found. */
  47. FIRFunctionsErrorCodeNotFound = 5,
  48. /** Some document that we attempted to create already exists. */
  49. FIRFunctionsErrorCodeAlreadyExists = 6,
  50. /** The caller does not have permission to execute the specified operation. */
  51. FIRFunctionsErrorCodePermissionDenied = 7,
  52. /**
  53. * Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system
  54. * is out of space.
  55. */
  56. FIRFunctionsErrorCodeResourceExhausted = 8,
  57. /**
  58. * Operation was rejected because the system is not in a state required for the operation's
  59. * execution.
  60. */
  61. FIRFunctionsErrorCodeFailedPrecondition = 9,
  62. /**
  63. * The operation was aborted, typically due to a concurrency issue like transaction aborts, etc.
  64. */
  65. FIRFunctionsErrorCodeAborted = 10,
  66. /** Operation was attempted past the valid range. */
  67. FIRFunctionsErrorCodeOutOfRange = 11,
  68. /** Operation is not implemented or not supported/enabled. */
  69. FIRFunctionsErrorCodeUnimplemented = 12,
  70. /**
  71. * Internal errors. Means some invariant expected by underlying system has been broken. If you
  72. * see one of these errors, something is very broken.
  73. */
  74. FIRFunctionsErrorCodeInternal = 13,
  75. /**
  76. * The service is currently unavailable. This is a most likely a transient condition and may be
  77. * corrected by retrying with a backoff.
  78. */
  79. FIRFunctionsErrorCodeUnavailable = 14,
  80. /** Unrecoverable data loss or corruption. */
  81. FIRFunctionsErrorCodeDataLoss = 15,
  82. /** The request does not have valid authentication credentials for the operation. */
  83. FIRFunctionsErrorCodeUnauthenticated = 16,
  84. } NS_SWIFT_NAME(FunctionsErrorCode);
  85. NS_ASSUME_NONNULL_END