Mover el bloque que queremos TryCatchear a un metodo sin captura de error
Invocamos al metodo con un On Error Resume Next y guardamos el error en un Array para loggearlo
Despejamos el Resume Next con el Goto 0 (NUNCA DEBE DEJARSE ABIERTO) y si se produjo un error loggeamos agregando info adicional que quedara registrada en el log de errores
Function TryCatchExample(pArg) For i = 1 To n On Error Resume Next TryCatchBlock pArg, i vErr = Array(Err.Number, Err.Source, Err.Description, Empty, Empty, Empty, Empty, Empty) On Error Goto 0 If vErr(0) <> 0 Then vErr(5) = "Full/Path/ToFind/TheMethod" ' Metodo 'vErr(6) = nro de linea si la tengo vErr(7) = "pArg=" & pArg & "-i=" & i ' Parametros que se puedan serializar a String dSession.LogError vErr End If Next End Function Function TryCatchBlock(pArg, pIndex) ' Aca trabajar SIN captura de error If pArg Then DoSomethingWith i End If End Function
No hay comentarios:
Publicar un comentario