WinForms

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ExceptionManager - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ExceptionManager

    Represents a class that provides a global hook for exceptions that have been catched inside the framework and gives you the option to provide specialized handling of the exception. You can also temporarily suspend and resume catching exceptions.

    Inheritance
    System.Object
    ExceptionManager
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Windows.Forms.Edit
    Assembly: Syncfusion.Edit.Windows.dll
    Syntax
    public class ExceptionManager
    Remarks

    The Syncfusion framework notifies ExceptionManager about exceptions that are catched by calling ExceptionManager.RaiseExceptionCatched or ExceptionManager. The RaiseExceptionCatched method will raise the ExceptionCatched event. By handling the ExceptionCatched event your code can analyze the exception that was catched and optionally let it bubble up by rethrowing the exception.

    Your code can also temporariliy suspend and resume catching exceptions. This is usefull if you want to provide your own exception handling. Just call SuspendCatchExceptions() to disable handling exceptions and ResumeCatchExceptions() to resume catching exceptions.

    You also have the options to disable catching exceptions alltogether by setting PassThroughExceptions to true.

    Note: All static settings for this class are thread local.

    Examples
    // The following example demonstrates temporarily suspending exception catching when calling a base class version
    // of a method.
    
            protected override void OnMouseDown(MouseEventArgs e)
                {
                ExceptionManager.SuspendCatchExceptions();
    
                try
                {
                    base.OnMouseDown(e);
                    ExceptionManager.ResumeCatchExceptions();
                }
                catch (Exception ex)
                {
                    ExceptionManager.ResumeCatchExceptions();
    
                        // Notify exception manager about the catched exception and
                        // give it a chance to optionally rethrow the exception if necessary
                        // (e.g. if this OnMouseDown was called from another class that
                        // wants to provide its own exception handling).
                    if (!ExceptionManager.RaiseExceptionCatched(this, ex))
    					throw ex;
    
                    // handle exception here
                    MessageBox.Show(ex.ToString());
                }
            }
    // This code snippet shows how exceptions are handled within the framework.
                    try
                    {
                        CurrentCell.Refresh();
                    }
                    catch (Exception ex)
                    {
                        TraceUtil.TraceExceptionCatched(ex);
                        if (!ExceptionManager.RaiseExceptionCatched(this, ex))
    						throw ex;
                    }

    Constructors

    ExceptionManager()

    Declaration
    public ExceptionManager()

    Properties

    PassThroughExceptions

    Gets or sets a value indicating whether disable catching exceptions all together by setting PassThroughExceptions to true.

    Declaration
    public static bool PassThroughExceptions { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    ResumeCatchExceptions()

    Temporarily suspend and resume catching exceptions. Call SuspendCatchExceptions() to disable handling exceptions and ResumeCatchExceptions() to resume catching exceptions.

    Declaration
    public static void ResumeCatchExceptions()

    ShouldCatchExceptions()

    Determines whether exceptions should be catched or if they should bubble up. calls this method.

    Declaration
    public static bool ShouldCatchExceptions()
    Returns
    Type Description
    System.Boolean

    SuspendCatchExceptions()

    Temporarily suspend and resume catching exceptions. Call SuspendCatchExceptions() to disable handling exceptions and ResumeCatchExceptions() to resume catching exceptions.

    Declaration
    public static void SuspendCatchExceptions()
    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved