AwbUpdater.ErrorHandler.HandleException C# (CSharp) Метод

HandleException() публичный статический Метод

Displays exception information. Should be called from try...catch handlers
public static HandleException ( Exception ex ) : void
ex System.Exception Exception object to handle
Результат void
        public static void HandleException(Exception ex)
        {
            if (ex == null || HandleKnownExceptions(ex)) return;

            // TODO: suggest a bug report for other exceptions
            ErrorHandler handler = new ErrorHandler { txtError = { Text = ex.Message } };

            var errorMessage = new BugReport(ex).PrintForPhabricator();
            handler.txtDetails.Text = errorMessage;

            handler.txtSubject.Text = ex.GetType().Name + " in " + Thrower(ex);

               // Tools.WriteDebug("HandleException", errorMessage);
            handler.ShowDialog();
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Main program function
        /// </summary>
        private void UpdateAwb()
        {
            try
            {
                _proxy = WebRequest.GetSystemWebProxy();

                if (_proxy.IsBypassed(new Uri("https://en.wikipedia.org")))
                {
                    _proxy = null;
                }

                UpdateUI("Getting current AWB and Updater versions", true);
                AWBVersion();

                if ((!_updaterUpdate && !_awbUpdate) && string.IsNullOrEmpty(_awbWebAddress))
                {
                    ExitEarly();
                    return;
                }
                UpdateUI("Creating a temporary directory", true);
                CreateTempDir();

                UpdateUI("Downloading AWB", true);
                GetAwbFromInternet();

                UpdateUI("Unzipping AWB to the temporary directory", true);
                UnzipAwb();

                UpdateUI("Making sure AWB is closed", true);
                CloseAwb();

                UpdateUI("Copying AWB files from temp to AWB directory...", true);
                CopyFiles();
                UpdateUI("Update successful", true);

                UpdateUI("Cleaning up from update", true);
                KillTempDir();

                UpdateUI("Update finished. You may close this window (AWB Updater) now.", true);
                _updateSucessful = true;
                ReadyToExit();
            }
            catch (AbortException)
            {
                ReadyToExit();
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }
        }
All Usage Examples Of AwbUpdater.ErrorHandler::HandleException