Skip to content

Commit

Permalink
See #7. Unsuccessful authentication now rejects correctly with an NSE…
Browse files Browse the repository at this point in the history
…rror instead of NSException.
  • Loading branch information
Glavin001 committed Jul 22, 2014
1 parent 2745179 commit c1012e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Common/SLAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,17 @@ - (PMKPromise *) authenticateWithUserEmail:(NSString *)theEmail
}).catch(rejecter);
} else
{
rejecter([NSException exceptionWithName:NSInternalInconsistencyException reason:@"Authenticating requires user's email, password, and organization." userInfo:nil]);

NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(@"Login was unsuccessful.", nil),
NSLocalizedFailureReasonErrorKey: NSLocalizedString(@"Authenticating requires user's email, password, and organization.", nil),
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Verify that you have entered all of the required fields.", nil)
};
NSError *error = [NSError errorWithDomain:SLErrorDomain
code:kCFErrorHTTPBadCredentials
userInfo:userInfo];
rejecter(error);

}
}];
}
Expand Down
4 changes: 4 additions & 0 deletions Common/SLCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ typedef void(^SLRequestCallback)(NSError *error, id operation, id responseObject
*/
#define SLSharedAPIManager [SLAPIManager sharedManager]

/**
*/
#define SLErrorDomain @"com.Streamlyne-Technologies-Ltd.Streamlyne"

/**
Source: http://stackoverflow.com/a/12137979/2578205
Expand Down

0 comments on commit c1012e6

Please sign in to comment.