ExceptionPrompt() public static méthode

Shows an error message for the given AggregateException.
public static ExceptionPrompt ( AggregateException ex ) : void
ex System.AggregateException The exception to show.
Résultat void
 /// <summary>
 /// Runs the given <seealso cref="Action"/> and handles all non-critical exceptions by showing an
 /// error dialog to the user. If the exception is critical, as determiend by <seealso cref="ErrorHandler.IsCriticalException(Exception)"/>
 /// then it is re-thrown as this could be that the process is not in a good state to continue executing.
 /// </summary>
 /// <param name="action"></param>
 public static void HandleExceptions(Action action)
 {
     try
     {
         action();
     }
     catch (AggregateException ex)
     {
         Debug.WriteLine($"Uncaught aggregate exception: {ex.Message}");
         if (ErrorHandler.ContainsCriticalException(ex))
         {
             throw;
         }
         EventsReporterWrapper.ReportEvent(UnhandledExceptionEvent.Create(ex));
         UserPromptUtils.ExceptionPrompt(ex);
     }
     catch (Exception ex)
     {
         Debug.WriteLine($"Uncaught exception: {ex.Message}");
         if (ErrorHandler.IsCriticalException(ex))
         {
             throw;
         }
         EventsReporterWrapper.ReportEvent(UnhandledExceptionEvent.Create(ex));
         UserPromptUtils.ExceptionPrompt(ex);
     }
 }
Exemple #2
0
        /// <summary>
        /// Sets the app engine to the given project Id.
        /// </summary>
        public static async Task <bool> SetAppRegionAsync(string projectId, IGaeDataSource dataSource)
        {
            string selectedLocation = AppEngineManagementWindow.PromptUser(projectId);

            if (selectedLocation == null)
            {
                Debug.WriteLine("The user cancelled creating a new app.");
                return(false);
            }

            try
            {
                await ProgressDialogWindow.PromptUser(
                    dataSource.CreateApplicationAsync(selectedLocation),
                    new ProgressDialogWindow.Options
                {
                    Title         = Resources.GaeUtilsSetAppEngineRegionProgressTitle,
                    Message       = Resources.GaeUtilsSetAppEngineRegionProgressMessage,
                    IsCancellable = false
                });

                return(true);
            }
            catch (DataSourceException ex)
            {
                UserPromptUtils.ExceptionPrompt(ex);
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// Runs the given <seealso cref="Task"/> and handles all non-critical exceptions by showing an
        /// error dialog to the user. If the exception is critical, as determiend by <seealso cref="ErrorHandler.IsCriticalException(Exception)"/>
        /// then it is re-thrown as this could be that the process is not in a good state to continue executing.
        /// </summary>
        public static async void HandleAsyncExceptions(Func <Task> task)
        {
            try
            {
                await task();
            }
            catch (Exception ex) when(!IsCriticalException(ex))
            {
                Debug.WriteLine($"Uncaught exception: {ex.Message}");

                EventsReporterWrapper.ReportEvent(UnhandledExceptionEvent.Create(ex));
                UserPromptUtils.ExceptionPrompt(ex);
            }
        }
Exemple #4
0
        /// <summary>
        /// Runs the given <seealso cref="Action"/> and handles all non-critical exceptions by showing an
        /// error dialog to the user. If the exception is critical, as determiend by <seealso cref="ErrorHandler.IsCriticalException(Exception)"/>
        /// then it is re-thrown as this could be that the process is not in a good state to continue executing.
        /// </summary>
        /// <param name="action"></param>
        public static void HandleExceptions(Action action)
        {
            try
            {
                action();
            }
            catch (Exception ex) when(!IsCriticalException(ex))
            {
                Debug.WriteLine($"Uncaught exception: {ex.Message}");

                EventsReporterWrapper.ReportEvent(UnhandledExceptionEvent.Create(ex));
                UserPromptUtils.ExceptionPrompt(ex);
            }
        }