コード例 #1
0
 public static UserErrorModel HandleException(Exception ex)
 {
     if (ex is DownloadException)
     {
         return(new RepositoryDownloadUserError(null, ex));
     }
     return(ErrorHandlerr.HandleException(ex));
 }
コード例 #2
0
        public async Task SaveLogs()
        {
            var path =
                Common.Paths.TempPath.GetChildFileWithName("Play withSIX diagnostics " + DateTime.UtcNow.ToFileTimeUtc() +
                                                           ".zip");
            await ErrorHandlerr.GenerateDiagnosticZip(path).ConfigureAwait(false);

            Tools.FileUtil.SelectInExplorer(path.ToString());
        }
コード例 #3
0
 Task CheckForUpdates()
 {
     if (!_firstCheck)
     {
         return(CheckForNewVersionHandleException());
     }
     _firstCheck = false;
     return(ErrorHandlerr.TryAction(() => CheckForNewVersion(), ExMessage));
 }
コード例 #4
0
        public async Task Handle(SaveLogs request)
        {
            var path =
                Common.Paths.TempPath.GetChildFileWithName("Sync diagnostics " + DateTime.UtcNow.ToFileTimeUtc() +
                                                           ".zip");

            Common.Paths.TempPath.MakeSurePathExists();
            await ErrorHandlerr.GenerateDiagnosticZip(path).ConfigureAwait(false);

            Tools.FileUtil.SelectInExplorer(path.ToString());
        }
コード例 #5
0
 public void InitializeCM()
 {
     UiTaskHandler.RegisterCommand = (command, action) => {
         // ThrownExceptions does not listen to Subscribe errors, but only in async task errors!
         command.ThrownExceptions
         .Select(x => ErrorHandlerr.HandleException(x, action))
         .SelectMany(UserErrorHandler.HandleUserError)
         .Where(x => x == RecoveryOptionResultModel.RetryOperation)
         .ObserveOn(RxApp.MainThreadScheduler)
         .InvokeCommand(command);
     };
     RxApp.SupportsRangeNotifications = false; // WPF doesnt :/
     SimpleInjectorContainerExtensions.RegisterReserved(typeof(IHandle), typeof(IScreen));
     SimpleInjectorContainerExtensions.RegisterReservedRoot(typeof(IHandle));
 }
コード例 #6
0
        async Task MoveExistingSynqDataWhenRequested(IAbsoluteDirectoryPath oldSynqPath,
                                                     IAbsoluteDirectoryPath newSynqPath, ISupportModding game)
        {
            if (ArePathsEqual(oldSynqPath, newSynqPath))
            {
                return;
            }

            var todo = await SynqPathChangedDialog(oldSynqPath, newSynqPath).ConfigureAwait(false);

            if (todo)
            {
                game.Controller.BundleManager.Repo.Dispose(); // Unlock
                await
                ErrorHandlerr.TryAction(
                    () => _updateManager.MovePathIfValidAndExists(oldSynqPath, newSynqPath))
                .ConfigureAwait(false);
            }
        }
コード例 #7
0
        private async Task <bool> HandleError(QueueItem item, Exception ex)
        {
            var result =
                await UserErrorHandler.HandleUserError(ErrorHandlerr.HandleException(ex, "Queue action: " + item.Title));

            switch (result)
            {
            case RecoveryOptionResultModel.RetryOperation:
                item.Retry(() => _messenger.Update(item));
                BuildContinuation(item);
                return(true);

            case RecoveryOptionResultModel.CancelOperation:
                item.UpdateState(CompletionState.Canceled);
                await Update(item).ConfigureAwait(false);

                return(true);
            }
            return(false);
        }
コード例 #8
0
        async Task OnlineInit()
        {
            await ErrorHandlerr.TryAction(() => _versionRegistry.Init(),
                                          "Processing of Version info").ConfigureAwait(false);

            await _prerequisitesInstaller.InstallPreRequisites().ConfigureAwait(false);

            //InitConnect();

            RunSelfUpdateInTheBackground();

            if (_systemInfo.IsInternetAvailable)
            {
                await
                ErrorHandlerr.TryAction(() => CheckDeprecatedVersion(), "Deprecated version check")
                .ConfigureAwait(false);
            }

            await InitialSync().ConfigureAwait(false);
        }
コード例 #9
0
        public void ConfigureCM()
        {
            RxApp.SupportsRangeNotifications = false; // WPF doesnt :/
            SimpleInjectorContainerExtensions.RegisterReserved(typeof(IHandle), typeof(IScreen));
            SimpleInjectorContainerExtensions.RegisterReservedRoot(typeof(IHandle));
            UiTaskHandler.RegisterCommand = (command, action) => {
                // ThrownExceptions does not listen to Subscribe errors, but only in async task errors!
                command.ThrownExceptions
                .Select(x => ErrorHandlerr.HandleException(x, action))
                .SelectMany(UserErrorHandler.HandleUserError)
                .Where(x => x == RecoveryOptionResultModel.RetryOperation)
                .ObserveOn(RxApp.MainThreadScheduler)
                .InvokeCommand(command);
            };
            SetupViewNamespaces();

            var mutableDependencyResolver = Locator.CurrentMutable;

            SetupRx(mutableDependencyResolver);
        }
コード例 #10
0
ファイル: Excecutor.cs プロジェクト: dkv01/withSIX.Desktop
        public async Task <TResponse> ExecuteCommand <TResponse>(Func <Task <TResponse> > action, object command,
                                                                 Func <string, Exception, Exception> createException)
        {
retry:
            try {
                return(await TryExecuteCommand(action).ConfigureAwait(false));
            } catch (AlreadyExistsException e) {
                // don't log
                throw createException(e.Message, e);
            } catch (ValidationException e) {
                // don't log
                throw createException(e.Message, e);
            } catch (UserException e) {
                MainLog.Logger.FormattedWarnException(e,
                                                      "UserException catched during hub action: " + command.GetType().Name);
                throw createException(e.Message, e);
                // TODO: A better way to handle this actually from within frontends...
            }

            // TODO: More general ignore when is shutting down?
            catch (OperationCanceledException ex) when(Common.Flags.ShuttingDown)
            {
                throw createException("The system is shutting down",
                                      new CanceledException("The operation was aborted because the system is shutting down", ex));
            } catch (ObjectDisposedException ex) when(Common.Flags.ShuttingDown)
            {
                throw createException("The system is shutting down",
                                      new CanceledException("The operation was aborted because the system is shutting down", ex));
            } catch (Exception ex) {
                var handleException = ErrorHandlerr.HandleException(ex, "Action: " + command.GetType().Name);
                var result          =
                    await UserErrorHandler.HandleUserError(handleException);

                if (result == RecoveryOptionResultModel.RetryOperation)
                {
                    goto retry;
                }
                throw createException("Operation aborted", new CanceledException("The operation was aborted", ex));
            }
        }
コード例 #11
0
        async Task MoveExistingModDataWhenRequested(IAbsoluteDirectoryPath oldModsPath,
                                                    IAbsoluteDirectoryPath newModPath, IAbsoluteDirectoryPath oldSynqPath,
                                                    IAbsoluteDirectoryPath newSynqPath, ISupportModding game)
        {
            if (ArePathsEqual(oldModsPath, newModPath))
            {
                if (oldSynqPath != null && newSynqPath != null)
                {
                    await MoveExistingSynqDataWhenRequested(oldSynqPath, newSynqPath, game);
                }
                return;
            }

            var todo = await ModPathChangedDialog(oldModsPath, newModPath);

            if (todo)
            {
                await
                ErrorHandlerr.TryAction(
                    () => PerformMoveModAndSynq(oldModsPath, newModPath, oldSynqPath, newSynqPath, game))
                .ConfigureAwait(false);
            }
        }
コード例 #12
0
 //if (!(@params != null)) throw new ArgumentNullException("@params != null");
 Task TryProcessParams(IEnumerable <string> @params) => ErrorHandlerr.TryAction(() => ProcessParams(@params),
                                                                                "Processing of startup parameters");
コード例 #13
0
 public CheatImpl(IActionDispatcher mediator, IExceptionHandler exceptionHandler, IMessageBus messageBus)
 {
     Mediator   = mediator;
     MessageBus = messageBus;
     ErrorHandlerr.SetExceptionHandler(exceptionHandler);
 }
コード例 #14
0
 void SetupExceptionHandling()
 {
     _exceptionHandler = Container.GetInstance <IExceptionHandler>();
     ErrorHandlerr.SetExceptionHandler(_exceptionHandler);
     OverrideCaliburnMicroActionHandling();
 }