NSError+FIRMessaging.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #import <FirebaseMessaging/FIRMessaging.h>
  18. NS_ASSUME_NONNULL_BEGIN
  19. FOUNDATION_EXPORT NSString *const kFIRMessagingDomain;
  20. // FIRMessaging Internal Error Code
  21. typedef NS_ENUM(NSUInteger, FIRMessagingErrorCode) {
  22. kFIRMessagingErrorCodeUnknown = 0,
  23. kFIRMessagingErrorCodeNetwork = 4,
  24. kFIRMessagingErrorCodeInvalidRequest = 7,
  25. kFIRMessagingErrorCodeInvalidTopicName = 8,
  26. // FIRMessaging generic errors
  27. kFIRMessagingErrorCodeMissingDeviceID = 501,
  28. // Upstream send errors
  29. kFIRMessagingErrorCodeServiceNotAvailable = 1001,
  30. kFIRMessagingErrorCodeMissingTo = 1003,
  31. kFIRMessagingErrorCodeSave = 1004,
  32. kFIRMessagingErrorCodeSizeExceeded = 1005,
  33. // Already connected with MCS
  34. kFIRMessagingErrorCodeAlreadyConnected = 2001,
  35. // PubSub errors
  36. kFIRMessagingErrorCodePubSubClientNotSetup = 3004,
  37. kFIRMessagingErrorCodePubSubOperationIsCancelled = 3005,
  38. };
  39. @interface NSError (FIRMessaging)
  40. + (NSError *)messagingErrorWithCode:(FIRMessagingErrorCode)fcmErrorCode
  41. failureReason:(NSString *)failureReason;
  42. @end
  43. NS_ASSUME_NONNULL_END