Initializes a new instance of the Exception class with its message and its inner exception set as specified.
[Visual Basic] Overloads Public Sub New( _ ByVal message As String, _ ByVal innerException As Exception _ ) [C#] public Exception( string message, Exception innerException ); [C++] public: Exception( String* message, Exception* innerException ); [JScript] public function Exception( message : String, innerException : Exception );
Exception Type | Condition |
---|---|
Exception.Message | message. |
Exception.InnerException | innerException |
Note that the stack trace is not started until the exception is thrown.
All derived classes should provide a constructor with a parameters list identical to the constructor's list.
When handling exceptions, it is sometimes desirable to throw another exception, which is more indicative of the error that has occurred. In order that the original exception with the information that it carries is not lost, exceptions have a field that can hold a reference to another exception.
Exception Class | Exception Members | System Namespace | Exception Constructor Overload List