System.Exception

Represent errors for structured exception handling

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
namespace System
public class Exception

The Exception class is used for structured exception handling and represents the errors that occur. See Exception classes for more information.

Constructors

Exception

public Exception()

Initializes a new instance of the Exception class.

or

public Exception(message)

Initializes a new instance of the Exception class with an error message (string) that explains why the error occured.

or

public Exception(message, inner)

Initializes a new instance of the Exception class with an error message (string) that explains why the error occurred and an inner exception (@Exception) that caused the current exception.

Properties

InnerException

public InnerException

Returns the exception instance that caused the current exception. (@Exception)

Message

public virtual Message

Returns the error message that describes the exception. (string)

Source

public virtual Source

Returns or sets the name of the application that caused the exception. (string)

StackTrace

public virtual StackTrace

Returns a text representation of the call stack at the time the exception was thrown. (string)

Methods

ToString

public override ToString(), string

Returns the string representation of the current exception. This includes the following components (if they exist), separated by the system line terminator: the name of the Exception class that was thrown, the Message, the result of calling ToString() on the InnerException, and the StackTrace.