2 * Copyright 2017 Google
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #import <Foundation/Foundation.h>
19 FOUNDATION_EXPORT NSString *const kFIRMessagingDomain;
21 typedef NS_ENUM(NSUInteger, FIRMessagingInternalErrorCode) {
23 kFIRMessagingErrorCodeUnknown = 0,
25 // HTTP related errors.
26 kFIRMessagingErrorCodeAuthentication = 1,
27 kFIRMessagingErrorCodeNoAccess = 2,
28 kFIRMessagingErrorCodeTimeout = 3,
29 kFIRMessagingErrorCodeNetwork = 4,
31 // Another operation is in progress.
32 kFIRMessagingErrorCodeOperationInProgress = 5,
34 // Failed to perform device check in.
35 kFIRMessagingErrorCodeRegistrarFailedToCheckIn = 6,
37 kFIRMessagingErrorCodeInvalidRequest = 7,
39 // FIRMessaging generic errors
40 kFIRMessagingErrorCodeMissingDeviceID = 501,
42 // upstream send errors
43 kFIRMessagingErrorServiceNotAvailable = 1001,
44 kFIRMessagingErrorInvalidParameters = 1002,
45 kFIRMessagingErrorMissingTo = 1003,
46 kFIRMessagingErrorSave = 1004,
47 kFIRMessagingErrorSizeExceeded = 1005,
51 // Already connected with MCS
52 kFIRMessagingErrorCodeAlreadyConnected = 2001,
55 kFIRMessagingErrorCodePubSubAlreadySubscribed = 3001,
56 kFIRMessagingErrorCodePubSubAlreadyUnsubscribed = 3002,
57 kFIRMessagingErrorCodePubSubInvalidTopic = 3003,
58 kFIRMessagingErrorCodePubSubFIRMessagingNotSetup = 3004,
59 kFIRMessagingErrorCodePubSubOperationIsCancelled = 3005,
62 @interface NSError (FIRMessaging)
64 @property(nonatomic, readonly) FIRMessagingInternalErrorCode fcmErrorCode;
66 + (NSError *)errorWithFCMErrorCode:(FIRMessagingInternalErrorCode)fcmErrorCode;
67 + (NSError *)fcm_errorWithCode:(NSInteger)code userInfo:(NSDictionary *)userInfo;