Inherits from NSObject
Declared in L7SErrors.h

Overview

There can be various errors and exceptions occurring in SDK at runtime, apps can subscribe for error callback by implementing an optional method in DidReceiveErrors: of L7SClientProtocol, and then set the delegate to L7SClientManager, for example:

[[L7SClientManager sharedClientManager] setDelegate:self];

The errors are encapsulated in an NSError object. We categorize the SDK system error is three domains. They are defined with the following constants:

extern NSString * const L7SAuthenticationDomain;
extern NSString * const L7SRegistrationDomain;
extern NSString * const L7SLocationDomain;
extern NSString * const L7SNetworkDomain;
extern NSString * const L7SJWTValidationDomain;
extern NSString * const L7SEnterpriseBrowserDomain;
extern NSString * const L7SClientCredentialDomain;

The following is a set of error codes defined:

//Error code for authentication domain
L7SAuthenticationLoginError = -101, //encountering login error
L7SAuthenticationJWTError = -102,  //encountering error when exchange credentials with JWT
L7SAuthenticationRefreshError = -103,  //encountering error when refresh credenitcails
L7SAuthenticationLogoutError = -104,  //encountering logout error
L7SAuthenticationLogoffError = -105,  //encountering logoff error
L7SSocialLoginError = -106,  //encountering social login error
L7SQRCodeAuthenticationError = -107,  // encoutering an error when the SDK fails to retrieve a session after its QR code is scanned.
L7SQRCodeAuthorizationError = -108,   // encoutering an error when the SDK fails to authorize with a QR code


//Error code for registration domain
L7SRegistrationError = -201,  //encountering errors during device registration
L7SDeRegistrationError = -202, //encountering errors during device de-registration

//Error code for location domain
L7SLocationError = -301,  //encountering location service error
L7SLocationUnauthorizedError = -302, //location is unauthorized

//Error code for network
L7SNetworkError = -401,  //encountering network service error

//HTTPCall error
L7SHTTPCallError = -501,  //only used in HTTP call error through PhoneGap plugin

//JWT validation errors
L7SJWTSignatureNotMatch = -701,
L7SJWTAUDNotMatch = -702,
L7SJWTAZPNotMatch = -703,
L7SJWTExpired = -704,
L7SJWTInvalidFormat = -705,

//Enterprise browser error
L7SEnterpriseBrowserInvalidJSON = -801,
L7SEnterrpiseBrowserNativeAppNotExist = -802,
L7SEnterrpiseBrowserInvalidURLError = -803,
L7SEnterrpiseBrowserAppNotExist = -804

//Dynamic client credential error
L7SDynamicClientCredentialError = -901

Here is an example of responding to an error callback:

- (void)DidReceiveError:(NSError *)error{
    switch([error code]) {
        case L7SAuthenticationJWTError:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[[error userInfo] objectForKey:NSLocalizedFailureReasonErrorKey]
                                                            message:[[error userInfo] objectForKey:NSLocalizedDescriptionKey]
                                                           delegate:nil
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:nil];
            [alert show];
            break;
        }
        default:
        break:
    }
}