Creating a non-trival custom GP tool - inputs, outputs, and responding to environment settings
' Copyright 2008 ESRI
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' See use restrictions at <your ArcGIS install location>/developerkit/userestrictions.txt.

Imports Microsoft.VisualBasic
Imports System

Namespace GPPointFileInfo
  Public Class GPException
    Inherits ApplicationException
    Private _exceptionSeverity As GPExceptionSeverity

    Public Sub New(ByVal exceptionSeverity As GPExceptionSeverity, ByVal message As String)
      _exceptionSeverity = exceptionSeverity
    End Sub

    Public Sub New(ByVal exceptionSeverity As GPExceptionSeverity, ByVal message As String, ByVal innerException As Exception)
      MyBase.New(message, innerException)
      _exceptionSeverity = exceptionSeverity
    End Sub

    Public Sub LogException(ByVal gpMessages As IGPMessages)
      Dim message As String = GetMessage()

      Select Case _exceptionSeverity
        Case GPExceptionSeverity.Warn

        Case GPExceptionSeverity.Error

        Case GPExceptionSeverity.Fatal
      End Select
    End Sub

    Private Function GetMessage() As String
      Dim message As String = Constants.vbLf & Me.Message

      If Not Me.InnerException Is Nothing Then
        Message &= "" & Me.InnerException.Message
      End If

      message &= Constants.vbLf

      Return message
    End Function
  End Class
End Namespace