You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.2 KiB

6 years ago
  1. /*
  2. * Copyright 2017 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. #import <Foundation/Foundation.h>
  17. FOUNDATION_EXPORT NSString *const kFIRMessagingDomain;
  18. typedef NS_ENUM(NSUInteger, FIRMessagingInternalErrorCode) {
  19. // Unknown error.
  20. kFIRMessagingErrorCodeUnknown = 0,
  21. // HTTP related errors.
  22. kFIRMessagingErrorCodeAuthentication = 1,
  23. kFIRMessagingErrorCodeNoAccess = 2,
  24. kFIRMessagingErrorCodeTimeout = 3,
  25. kFIRMessagingErrorCodeNetwork = 4,
  26. // Another operation is in progress.
  27. kFIRMessagingErrorCodeOperationInProgress = 5,
  28. // Failed to perform device check in.
  29. kFIRMessagingErrorCodeRegistrarFailedToCheckIn = 6,
  30. kFIRMessagingErrorCodeInvalidRequest = 7,
  31. // FIRMessaging generic errors
  32. kFIRMessagingErrorCodeMissingDeviceID = 501,
  33. // upstream send errors
  34. kFIRMessagingErrorServiceNotAvailable = 1001,
  35. kFIRMessagingErrorInvalidParameters = 1002,
  36. kFIRMessagingErrorMissingTo = 1003,
  37. kFIRMessagingErrorSave = 1004,
  38. kFIRMessagingErrorSizeExceeded = 1005,
  39. // Future Send Errors
  40. // MCS errors
  41. // Already connected with MCS
  42. kFIRMessagingErrorCodeAlreadyConnected = 2001,
  43. // PubSub errors
  44. kFIRMessagingErrorCodePubSubAlreadySubscribed = 3001,
  45. kFIRMessagingErrorCodePubSubAlreadyUnsubscribed = 3002,
  46. kFIRMessagingErrorCodePubSubInvalidTopic = 3003,
  47. kFIRMessagingErrorCodePubSubFIRMessagingNotSetup = 3004,
  48. kFIRMessagingErrorCodePubSubOperationIsCancelled = 3005,
  49. };
  50. @interface NSError (FIRMessaging)
  51. @property(nonatomic, readonly) FIRMessagingInternalErrorCode fcmErrorCode;
  52. + (NSError *)errorWithFCMErrorCode:(FIRMessagingInternalErrorCode)fcmErrorCode;
  53. + (NSError *)fcm_errorWithCode:(NSInteger)code userInfo:(NSDictionary *)userInfo;
  54. @end