public void SetsTheOutdatedClientVersionFlag()
        {
            var exception = new ClientDeprecatedException(request, response);

            errorHandlingService.TryHandleDeprecationError(Arg.Any <ClientDeprecatedException>()).Returns(true);

            errorsSubject.OnNext(exception);

            errorHandlingService.Received().TryHandleDeprecationError(Arg.Is(exception));
            errorHandlingService.DidNotReceive().TryHandleUnauthorizedError(Arg.Is(exception));
        }
Пример #2
0
        private void onError(Exception exception)
        {
            isLoadingSubject.OnNext(false);
            onCompleted();

            if (errorHandlingService.TryHandleDeprecationError(exception))
            {
                return;
            }

            switch (exception)
            {
            case UnauthorizedException forbidden:
                errorMessageSubject.OnNext(Resources.IncorrectEmailOrPassword);
                break;

            case GoogleLoginException googleEx when googleEx.LoginWasCanceled:
                errorMessageSubject.OnNext("");
                break;

            default:
                errorMessageSubject.OnNext(Resources.GenericLoginError);
                break;
            }
        }
Пример #3
0
        private void onError(Exception exception)
        {
            isLoadingSubject.OnNext(false);
            onCompleted();

            if (errorHandlingService.TryHandleDeprecationError(exception))
            {
                return;
            }

            switch (exception)
            {
            case UnauthorizedException forbidden:
                errorMessageSubject.OnNext(Resources.IncorrectEmailOrPassword);
                break;

            case GoogleLoginException googleEx when googleEx.LoginWasCanceled:
                errorMessageSubject.OnNext(string.Empty);
                break;

            case EmailIsAlreadyUsedException _:
                errorMessageSubject.OnNext(Resources.EmailIsAlreadyUsedError);
                break;

            default:
                analyticsService.UnknownSignUpFailure.Track(exception.GetType().FullName, exception.Message);
                analyticsService.TrackAnonymized(exception);
                errorMessageSubject.OnNext(Resources.GenericSignUpError);
                break;
            }
        }
Пример #4
0
        private void onError(Exception exception)
        {
            IsLoading = false;
            onCompleted();

            if (errorHandlingService.TryHandleDeprecationError(exception))
            {
                return;
            }

            switch (exception)
            {
            case UnauthorizedException forbidden:
                ErrorMessage = Resources.IncorrectEmailOrPassword;
                break;

            case GoogleLoginException googleEx when googleEx.LoginWasCanceled:
                ErrorMessage = "";
                break;

            default:
                ErrorMessage = Resources.GenericLoginError;
                break;
            }
        }
Пример #5
0
 private void onError(Exception exception)
 {
     if (!errorHandlingService.TryHandleDeprecationError(exception) &&
         !errorHandlingService.TryHandleUnauthorizedError(exception) &&
         !errorHandlingService.TryHandleNoWorkspaceError(exception) &&
         !errorHandlingService.TryHandleNoDefaultWorkspaceError(exception))
     {
         throw new ArgumentException(
                   $"{nameof(SyncErrorHandlingService)} could not handle unknown sync error {exception.GetType().FullName}.",
                   exception);
     }
 }
Пример #6
0
        private void onSyncError(Exception exception)
        {
            if (errorHandlingService.TryHandleDeprecationError(exception) ||
                errorHandlingService.TryHandleUnauthorizedError(exception) ||
                errorHandlingService.TryHandleNoWorkspaceError(exception))
            {
                stopSyncingOnSignal();
                return;
            }

            throw new ArgumentException($"{nameof(TogglDataSource)} could not handle unknown sync error {exception.GetType().FullName}.", exception);
        }