' 26/06/2027 MANMOG Version 3.0.6 Se añade tsExcepcion
This commit is contained in:
@@ -31,11 +31,12 @@ Imports System.Runtime.InteropServices
|
||||
' mediante el asterisco ('*'), como se muestra a continuación:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("3.0.5")>
|
||||
<Assembly: AssemblyFileVersion("3.0.5")>
|
||||
<Assembly: AssemblyVersion("3.0.6")>
|
||||
<Assembly: AssemblyFileVersion("3.0.6")>
|
||||
|
||||
|
||||
' Modificaciones:
|
||||
' ===============
|
||||
' 26/06/2027 MANMOG Version 3.0.6 Se añade tsExcepcion
|
||||
' 03/06/2027 MANMOG Version 3.0.5 Correccion en tsNotificacionesClient
|
||||
' 14/05/2026 MANMOG Version 3.0.4 Actualización de .nuspec para que incluya dependencias externas
|
||||
107
tsExcepcion.vb
Normal file
107
tsExcepcion.vb
Normal file
@@ -0,0 +1,107 @@
|
||||
Imports System
|
||||
Imports System.Runtime.Serialization
|
||||
Imports Microsoft.VisualBasic
|
||||
Imports Microsoft.VisualBasic.CompilerServices
|
||||
|
||||
|
||||
|
||||
<Serializable>
|
||||
Public Class tsExcepcion
|
||||
Inherits ApplicationException
|
||||
Public Enum ModoBusquedaEnum As Long
|
||||
EnTodaLaCadena
|
||||
DesdeExcepcionSiguiente
|
||||
SoloEnExcepcionActual
|
||||
End Enum
|
||||
|
||||
Private pCodigo As String
|
||||
|
||||
Private pDatosExtra As String
|
||||
|
||||
Public ReadOnly Property Codigo As String
|
||||
Get
|
||||
Return pCodigo
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DatosExtra As String
|
||||
Get
|
||||
Return pDatosExtra
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub New(message As String, Optional argCodigo As String = Nothing, Optional argDatosExtra As String = Nothing)
|
||||
MyBase.New(message)
|
||||
pCodigo = argCodigo
|
||||
pDatosExtra = argDatosExtra
|
||||
End Sub
|
||||
|
||||
Public Sub New(message As String, innerException As Exception, Optional argCodigo As String = Nothing, Optional argDatosExtra As String = Nothing)
|
||||
MyBase.New(message, innerException)
|
||||
pCodigo = argCodigo
|
||||
pDatosExtra = argDatosExtra
|
||||
End Sub
|
||||
|
||||
Protected Sub New(info As SerializationInfo, context As StreamingContext)
|
||||
MyBase.New(info, context)
|
||||
pCodigo = info.GetString("pCodigo")
|
||||
pDatosExtra = info.GetString("pDatosExtra")
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub GetObjectData(info As SerializationInfo, context As StreamingContext)
|
||||
MyBase.GetObjectData(info, context)
|
||||
info.AddValue("pCodigo", pCodigo)
|
||||
info.AddValue("pDatosExtra", pDatosExtra)
|
||||
End Sub
|
||||
|
||||
Public Shared Function Buscar(excepcion As Exception, patronCodigo As String, Optional modoBusqueda As ModoBusquedaEnum = ModoBusquedaEnum.EnTodaLaCadena) As tsExcepcion
|
||||
Try
|
||||
If excepcion Is Nothing Then
|
||||
Throw New tsExcepcion("'excepcion' es Nothing.")
|
||||
End If
|
||||
|
||||
If Not [Enum].IsDefined(GetType(ModoBusquedaEnum), modoBusqueda) Then
|
||||
Throw New tsExcepcion("Modo de búsqueda incorrecto: " & Conversions.ToString(modoBusqueda))
|
||||
End If
|
||||
|
||||
Dim ex = excepcion
|
||||
If modoBusqueda = ModoBusquedaEnum.DesdeExcepcionSiguiente Then
|
||||
ex = ex.InnerException
|
||||
End If
|
||||
|
||||
Dim num = 1
|
||||
Do
|
||||
If ex Is Nothing Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If TypeOf ex Is tsExcepcion Then
|
||||
Dim text = CType(ex, tsExcepcion).Codigo
|
||||
If Equals(text, Nothing) Then
|
||||
text = ""
|
||||
End If
|
||||
|
||||
If LikeOperator.LikeString(text, patronCodigo, CompareMethod.Binary) Then
|
||||
Return CType(ex, tsExcepcion)
|
||||
End If
|
||||
End If
|
||||
|
||||
ex = ex.InnerException
|
||||
If modoBusqueda = ModoBusquedaEnum.SoloEnExcepcionActual Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
num = num + 1
|
||||
Loop While num <= 1000000
|
||||
Throw New tsExcepcion("Bucle cuasi-infinito.")
|
||||
Catch ex2 As Exception
|
||||
ProjectData.SetProjectError(ex2)
|
||||
Dim ex3 = ex2
|
||||
Throw New tsExcepcion("Buscando tsExcepcion con código: " & patronCodigo & vbCrLf & ex3.Message, ex3)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function Es(excepcion As Exception, patronCodigo As String, Optional modoBusqueda As ModoBusquedaEnum = ModoBusquedaEnum.EnTodaLaCadena) As Boolean
|
||||
Return Buscar(excepcion, patronCodigo, modoBusqueda) IsNot Nothing
|
||||
End Function
|
||||
End Class
|
||||
@@ -152,6 +152,7 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="tsBloqueo.vb" />
|
||||
<Compile Include="tsExcepcion.vb" />
|
||||
<Compile Include="tsNotificacionesClient.vb" />
|
||||
<Compile Include="UrlDetector.vb" />
|
||||
<Compile Include="Utilidades.vb" />
|
||||
|
||||
Reference in New Issue
Block a user