public static UserErrorModel HandleException(Exception ex) { if (ex is DownloadException) { return(new RepositoryDownloadUserError(null, ex)); } return(ErrorHandlerr.HandleException(ex)); }
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()); }
Task CheckForUpdates() { if (!_firstCheck) { return(CheckForNewVersionHandleException()); } _firstCheck = false; return(ErrorHandlerr.TryAction(() => CheckForNewVersion(), ExMessage)); }
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()); }
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)); }
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); } }
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); }
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); }
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); }
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)); } }
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); } }
//if (!(@params != null)) throw new ArgumentNullException("@params != null"); Task TryProcessParams(IEnumerable <string> @params) => ErrorHandlerr.TryAction(() => ProcessParams(@params), "Processing of startup parameters");
public CheatImpl(IActionDispatcher mediator, IExceptionHandler exceptionHandler, IMessageBus messageBus) { Mediator = mediator; MessageBus = messageBus; ErrorHandlerr.SetExceptionHandler(exceptionHandler); }
void SetupExceptionHandling() { _exceptionHandler = Container.GetInstance <IExceptionHandler>(); ErrorHandlerr.SetExceptionHandler(_exceptionHandler); OverrideCaliburnMicroActionHandling(); }