private static SyncManagerException HandleException()

in src/Storage/CognitoSyncStorage.cs [116:149]


        private static SyncManagerException HandleException(Exception e, string message)
        {
            var ase = e as AmazonServiceException;

            if (ase == null) ase = new AmazonServiceException(e);

            if (ase.GetType() == typeof(ResourceNotFoundException))
            {
                return new DatasetNotFoundException(message);
            }
            else if (ase.GetType() == typeof(ResourceConflictException)
                     || ase.StatusCode == System.Net.HttpStatusCode.Conflict)
            {
                return new DataConflictException(message);
            }
            else if (ase.GetType() == typeof(LimitExceededException))
            {
                return new DataLimitExceededException(message);
            }
            else if (IsNetworkException(ase))
            {
                return new NetworkException(message);
            }
            else if (ase.GetType() == typeof(AmazonCognitoSyncException)
                     && ase.Message != null 
                     && ase.Message.StartsWith("Current SyncCount for:", StringComparison.Ordinal))
            {
                return new DataConflictException(message);
            }
            else
            {
                return new DataStorageException(message, ase);
            }
        }