commit | author | age
|
2e29a3
|
1 |
/* |
L |
2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* This source code is licensed under the license found in the |
|
6 |
* LICENSE file in the root directory of this source tree. |
|
7 |
*/ |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
|
|
11 |
NS_ASSUME_NONNULL_BEGIN |
|
12 |
|
|
13 |
/** |
|
14 |
The error domain for all errors from FBSDKCoreKit. |
|
15 |
|
|
16 |
Error codes from the SDK in the range 0-99 are reserved for this domain. |
|
17 |
*/ |
|
18 |
FOUNDATION_EXPORT NSErrorDomain const FBSDKErrorDomain |
|
19 |
NS_SWIFT_NAME(ErrorDomain); |
|
20 |
|
|
21 |
/* |
|
22 |
@methodgroup error userInfo keys |
|
23 |
*/ |
|
24 |
|
|
25 |
/** |
|
26 |
The userInfo key for the invalid collection for errors with FBSDKErrorInvalidArgument. |
|
27 |
|
|
28 |
If the invalid argument is a collection, the collection can be found with this key and the individual |
|
29 |
invalid item can be found with FBSDKErrorArgumentValueKey. |
|
30 |
*/ |
|
31 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentCollectionKey |
|
32 |
NS_SWIFT_NAME(ErrorArgumentCollectionKey); |
|
33 |
|
|
34 |
/** |
|
35 |
The userInfo key for the invalid argument name for errors with FBSDKErrorInvalidArgument. |
|
36 |
*/ |
|
37 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentNameKey |
|
38 |
NS_SWIFT_NAME(ErrorArgumentNameKey); |
|
39 |
|
|
40 |
/** |
|
41 |
The userInfo key for the invalid argument value for errors with FBSDKErrorInvalidArgument. |
|
42 |
*/ |
|
43 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentValueKey |
|
44 |
NS_SWIFT_NAME(ErrorArgumentValueKey); |
|
45 |
|
|
46 |
/** |
|
47 |
The userInfo key for the message for developers in NSErrors that originate from the SDK. |
|
48 |
|
|
49 |
The developer message will not be localized and is not intended to be presented within the app. |
|
50 |
*/ |
|
51 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorDeveloperMessageKey |
|
52 |
NS_SWIFT_NAME(ErrorDeveloperMessageKey); |
|
53 |
|
|
54 |
/** |
|
55 |
The userInfo key describing a localized description that can be presented to the user. |
|
56 |
*/ |
|
57 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorLocalizedDescriptionKey |
|
58 |
NS_SWIFT_NAME(ErrorLocalizedDescriptionKey); |
|
59 |
|
|
60 |
/** |
|
61 |
The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`. |
|
62 |
*/ |
|
63 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorLocalizedTitleKey |
|
64 |
NS_SWIFT_NAME(ErrorLocalizedTitleKey); |
|
65 |
|
|
66 |
/* |
|
67 |
@methodgroup FBSDKGraphRequest error userInfo keys |
|
68 |
*/ |
|
69 |
|
|
70 |
/** |
|
71 |
The userInfo key describing the error category, for error recovery purposes. |
|
72 |
|
|
73 |
See `FBSDKGraphErrorRecoveryProcessor` and `[FBSDKGraphRequest disableErrorRecovery]`. |
|
74 |
*/ |
|
75 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorKey |
|
76 |
NS_SWIFT_NAME(GraphRequestErrorKey); |
|
77 |
|
|
78 |
/* |
|
79 |
The userInfo key for the Graph API error code. |
|
80 |
*/ |
|
81 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorCodeKey |
|
82 |
NS_SWIFT_NAME(GraphRequestErrorGraphErrorCodeKey); |
|
83 |
|
|
84 |
/* |
|
85 |
The userInfo key for the Graph API error subcode. |
|
86 |
*/ |
|
87 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorSubcodeKey |
|
88 |
NS_SWIFT_NAME(GraphRequestErrorGraphErrorSubcodeKey); |
|
89 |
|
|
90 |
/* |
|
91 |
The userInfo key for the HTTP status code. |
|
92 |
*/ |
|
93 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorHTTPStatusCodeKey |
|
94 |
NS_SWIFT_NAME(GraphRequestErrorHTTPStatusCodeKey); |
|
95 |
|
|
96 |
/* |
|
97 |
The userInfo key for the raw JSON response. |
|
98 |
*/ |
|
99 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorParsedJSONResponseKey |
|
100 |
NS_SWIFT_NAME(GraphRequestErrorParsedJSONResponseKey); |
|
101 |
|
|
102 |
/* |
|
103 |
@methodgroup Common Code Block typedefs |
|
104 |
*/ |
|
105 |
|
|
106 |
/** |
|
107 |
Success Block |
|
108 |
*/ |
|
109 |
typedef void (^ FBSDKCodeBlock)(void) |
|
110 |
NS_SWIFT_NAME(CodeBlock); |
|
111 |
|
|
112 |
/** |
|
113 |
Error Block |
|
114 |
*/ |
|
115 |
typedef void (^ FBSDKErrorBlock)(NSError *_Nullable error) |
|
116 |
NS_SWIFT_NAME(ErrorBlock); |
|
117 |
|
|
118 |
/** |
|
119 |
Success Block |
|
120 |
*/ |
|
121 |
typedef void (^ FBSDKSuccessBlock)(BOOL success, NSError *_Nullable error) |
|
122 |
NS_SWIFT_NAME(SuccessBlock); |
|
123 |
|
|
124 |
/* |
|
125 |
@methodgroup Enums |
|
126 |
*/ |
|
127 |
|
|
128 |
#ifndef NS_ERROR_ENUM |
|
129 |
#define NS_ERROR_ENUM(_domain, _name) \ |
|
130 |
enum _name : NSInteger _name; \ |
|
131 |
enum __attribute__((ns_error_domain(_domain))) _name: NSInteger |
|
132 |
#endif |
|
133 |
|
|
134 |
/** |
|
135 |
FBSDKCoreError |
|
136 |
Error codes for FBSDKErrorDomain. |
|
137 |
*/ |
|
138 |
typedef NS_ERROR_ENUM (FBSDKErrorDomain, FBSDKCoreError) |
|
139 |
{ |
|
140 |
/** |
|
141 |
Reserved. |
|
142 |
*/ |
|
143 |
FBSDKErrorReserved = 0, |
|
144 |
|
|
145 |
/** |
|
146 |
The error code for errors from invalid encryption on incoming encryption URLs. |
|
147 |
*/ |
|
148 |
FBSDKErrorEncryption, |
|
149 |
|
|
150 |
/** |
|
151 |
The error code for errors from invalid arguments to SDK methods. |
|
152 |
*/ |
|
153 |
FBSDKErrorInvalidArgument, |
|
154 |
|
|
155 |
/** |
|
156 |
The error code for unknown errors. |
|
157 |
*/ |
|
158 |
FBSDKErrorUnknown, |
|
159 |
|
|
160 |
/** |
|
161 |
A request failed due to a network error. Use NSUnderlyingErrorKey to retrieve |
|
162 |
the error object from the NSURLSession for more information. |
|
163 |
*/ |
|
164 |
FBSDKErrorNetwork, |
|
165 |
|
|
166 |
/** |
|
167 |
The error code for errors encountered during an App Events flush. |
|
168 |
*/ |
|
169 |
FBSDKErrorAppEventsFlush, |
|
170 |
|
|
171 |
/** |
|
172 |
An endpoint that returns a binary response was used with FBSDKGraphRequestConnection. |
|
173 |
|
|
174 |
Endpoints that return image/jpg, etc. should be accessed using NSURLRequest |
|
175 |
*/ |
|
176 |
FBSDKErrorGraphRequestNonTextMimeTypeReturned, |
|
177 |
|
|
178 |
/** |
|
179 |
The operation failed because the server returned an unexpected response. |
|
180 |
|
|
181 |
You can get this error if you are not using the most recent SDK, or you are accessing a version of the |
|
182 |
Graph API incompatible with the current SDK. |
|
183 |
*/ |
|
184 |
FBSDKErrorGraphRequestProtocolMismatch, |
|
185 |
|
|
186 |
/** |
|
187 |
The Graph API returned an error. |
|
188 |
|
|
189 |
See below for useful userInfo keys (beginning with FBSDKGraphRequestError*) |
|
190 |
*/ |
|
191 |
FBSDKErrorGraphRequestGraphAPI, |
|
192 |
|
|
193 |
/** |
|
194 |
The specified dialog configuration is not available. |
|
195 |
|
|
196 |
This error may signify that the configuration for the dialogs has not yet been downloaded from the server |
|
197 |
or that the dialog is unavailable. Subsequent attempts to use the dialog may succeed as the configuration is loaded. |
|
198 |
*/ |
|
199 |
FBSDKErrorDialogUnavailable, |
|
200 |
|
|
201 |
/** |
|
202 |
Indicates an operation failed because a required access token was not found. |
|
203 |
*/ |
|
204 |
FBSDKErrorAccessTokenRequired, |
|
205 |
|
|
206 |
/** |
|
207 |
Indicates an app switch (typically for a dialog) failed because the destination app is out of date. |
|
208 |
*/ |
|
209 |
FBSDKErrorAppVersionUnsupported, |
|
210 |
|
|
211 |
/** |
|
212 |
Indicates an app switch to the browser (typically for a dialog) failed. |
|
213 |
*/ |
|
214 |
FBSDKErrorBrowserUnavailable, |
|
215 |
|
|
216 |
/** |
|
217 |
Indicates that a bridge api interaction was interrupted. |
|
218 |
*/ |
|
219 |
FBSDKErrorBridgeAPIInterruption, |
|
220 |
|
|
221 |
/** |
|
222 |
Indicates that a bridge api response creation failed. |
|
223 |
*/ |
|
224 |
FBSDKErrorBridgeAPIResponse, |
|
225 |
} NS_SWIFT_NAME(CoreError); |
|
226 |
|
|
227 |
/** |
|
228 |
FBSDKGraphRequestError |
|
229 |
Describes the category of Facebook error. See `FBSDKGraphRequestErrorKey`. |
|
230 |
*/ |
|
231 |
typedef NS_ENUM(NSUInteger, FBSDKGraphRequestError) { |
|
232 |
/** The default error category that is not known to be recoverable. Check `FBSDKLocalizedErrorDescriptionKey` for a user facing message. */ |
|
233 |
FBSDKGraphRequestErrorOther = 0, |
|
234 |
/** Indicates the error is temporary (such as server throttling). While a recoveryAttempter will be provided with the error instance, the attempt is guaranteed to succeed so you can simply retry the operation if you do not want to present an alert. */ |
|
235 |
FBSDKGraphRequestErrorTransient = 1, |
|
236 |
/** Indicates the error can be recovered (such as requiring a login). A recoveryAttempter will be provided with the error instance that can take UI action. */ |
|
237 |
FBSDKGraphRequestErrorRecoverable = 2, |
|
238 |
} NS_SWIFT_NAME(GraphRequestError); |
|
239 |
|
|
240 |
NS_ASSUME_NONNULL_END |