Bronco Solutions

Knowledge Management and Collaboration Platform
Welcome to Bronco Solutions Sign in | Join | Help
in Search

Andrew Renner

Code Snippet: Exception Class

Here is my first code snippet.  Although there is one similar in the snippets library this one has all the intellisense built in.

Download the snippet at the end of this post.

To Install Snippet:

To use the snippet:

  • Either right click and click Insert Snippet
  • OR type BSExcept<tab>

The result is the following:

[code language="VB.NET"]
<Serializable()> _
Public Class MyException
    Inherits ApplicationException

    ''' <summary>
    ''' Initializes a new instance of the System.SystemLogException
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New()
        MyBase.New()
    End Sub

    ''' <summary>
    ''' Initializes a new instance of the System.SystemLogException
    ''' </summary>
    ''' <param name="message">Required. The error message that explains the reason for the exception.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal message As String)
        MyBase.New(message)
    End Sub

    ''' <summary>
    ''' Initializes a new instance of the System.SystemLogException
    ''' </summary>
    ''' <param name="message">Required. The error message that explains the reason for the exception.</param>
    ''' <param name="innerException">Required. The exception that is the cause for the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal message As String, ByVal innerException As Exception)
        MyBase.New(message, innerException)
    End Sub

    ''' <summary>
    ''' Initializes a new instance of the System.SystemLogException
    ''' </summary>
    ''' <param name="info">Required. The object that holds the serialized object data.</param>
    ''' <param name="context">Required. The contextual information about the source or destination.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
        MyBase.New(info, context)
    End Sub
End Class[/code]

 

Published Wednesday, March 29, 2006 12:59 AM by rennera
Attachment(s): DefineAnExceptionClass.snippet

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit