|
| 1 | +/* |
| 2 | + * Copyright 2012 Facebook |
| 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 | + |
| 17 | +#import <Foundation/Foundation.h> |
| 18 | + |
| 19 | +/// The error domain of all error codes returned by the Facebook SDK |
| 20 | +extern NSString *const FacebookSDKDomain; |
| 21 | + |
| 22 | +// ---------------------------------------------------------------------------- |
| 23 | +// Keys in the userInfo NSDictionary of NSError where you can find additional |
| 24 | +// information about the error. All are optional. |
| 25 | + |
| 26 | +/// The key for an inner NSError. |
| 27 | +extern NSString *const FBErrorInnerErrorKey; |
| 28 | + |
| 29 | +/// The key for parsed JSON response from the server. In case of a batch, |
| 30 | +/// includes the JSON for a single FBRequest. |
| 31 | +extern NSString *const FBErrorParsedJSONResponseKey; |
| 32 | + |
| 33 | +/// The key for HTTP status code. |
| 34 | +extern NSString *const FBErrorHTTPStatusCodeKey; |
| 35 | + |
| 36 | +// ---------------------------------------------------------------------------- |
| 37 | +/*! |
| 38 | + @abstract Error codes returned by the Facebook SDK in NSError. |
| 39 | + |
| 40 | + @discussion |
| 41 | + These are valid only in the scope of FacebookSDKDomain. |
| 42 | + */ |
| 43 | +typedef enum FBErrorCode { |
| 44 | + /*! |
| 45 | + Like nil for FBErrorCode values, represents an error code that |
| 46 | + has not been initialized yet. |
| 47 | + */ |
| 48 | + FBErrorInvalid = 0, |
| 49 | + |
| 50 | + /// The operation failed because it was cancelled. |
| 51 | + FBErrorOperationCancelled, |
| 52 | + |
| 53 | + /// A login attempt failed |
| 54 | + FBErrorLoginFailedOrCancelled, |
| 55 | + |
| 56 | + /// The graph API returned an error for this operation. |
| 57 | + FBErrorRequestConnectionApi, |
| 58 | + |
| 59 | + /*! |
| 60 | + The operation failed because the server returned an unexpected |
| 61 | + response. You can get this error if you are not using the most |
| 62 | + recent SDK, or if you set your application's migration settings |
| 63 | + incorrectly for the version of the SDK you are using. |
| 64 | + |
| 65 | + If this occurs on the current SDK with proper app migration |
| 66 | + settings, you may need to try changing to one request per batch. |
| 67 | + */ |
| 68 | + FBErrorProtocolMismatch, |
| 69 | + |
| 70 | + /// Non-success HTTP status code was returned from the operation. |
| 71 | + FBErrorHTTPError, |
| 72 | + |
| 73 | + /// An endpoint that returns a binary response was used with FBRequestConnection; |
| 74 | + /// endpoints that return image/jpg, etc. should be accessed using NSURLRequest |
| 75 | + FBErrorNonTextMimeTypeReturned, |
| 76 | + |
| 77 | + /// An error occurred while trying to display a native dialog |
| 78 | + FBErrorNativeDialog, |
| 79 | +} FBErrorCode; |
| 80 | + |
| 81 | +/*! |
| 82 | + The key in the userInfo NSDictionary of NSError where you can find |
| 83 | + the inner NSError (if any). |
| 84 | + */ |
| 85 | +extern NSString *const FBErrorInnerErrorKey; |
| 86 | + |
| 87 | +/// The NSError key used by session to capture login failure reason |
| 88 | +extern NSString *const FBErrorLoginFailedReason; |
| 89 | + |
| 90 | +/// the NSError key used by session to capture login failure error code |
| 91 | +extern NSString *const FBErrorLoginFailedOriginalErrorCode; |
| 92 | + |
| 93 | +/// used by session when an inline dialog fails |
| 94 | +extern NSString *const FBErrorLoginFailedReasonInlineCancelledValue; |
| 95 | +extern NSString *const FBErrorLoginFailedReasonInlineNotCancelledValue; |
| 96 | +extern NSString *const FBErrorLoginFailedReasonUnitTestResponseUnrecognized; |
| 97 | + |
| 98 | +/// used by session when a reauthorize fails |
| 99 | +extern NSString *const FBErrorReauthorizeFailedReasonSessionClosed; |
| 100 | +extern NSString *const FBErrorReauthorizeFailedReasonUserCancelled; |
| 101 | +extern NSString *const FBErrorReauthorizeFailedReasonWrongUser; |
| 102 | + |
| 103 | +/// The key to retrieve the reason for a native dialog error |
| 104 | +extern NSString *const FBErrorNativeDialogReasonKey; |
| 105 | + |
| 106 | +/// indicates that a native dialog is not supported in the current OS |
| 107 | +extern NSString *const FBErrorNativeDialogNotSupported; |
| 108 | +/// indicates that a native dialog can't be displayed because it is not appropriate for the current session |
| 109 | +extern NSString *const FBErrorNativeDialogInvalidForSession; |
| 110 | +/// indicates that a native dialog can't be displayed for some other reason |
| 111 | +extern NSString *const FBErrorNativeDialogCantBeDisplayed; |
| 112 | + |
| 113 | +// Exception strings raised by the Facebook SDK |
| 114 | + |
| 115 | +/*! |
| 116 | + This exception is raised by methods in the Facebook SDK to indicate |
| 117 | + that an attempted operation is invalid |
| 118 | + */ |
| 119 | +extern NSString *const FBInvalidOperationException; |
| 120 | + |
| 121 | +// Facebook SDK also raises exceptions the following common exceptions: |
| 122 | +// NSInvalidArgumentException |
| 123 | + |
0 commit comments