Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. More an Implimentation Horror

More an Implimentation Horror

Scheduled Pinned Locked Moved The Weird and The Wonderful
helpquestioncareer
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nagy Vilmos
    wrote on last edited by
    #1

    0. This code is in the region of 10 years old and I only had VB (probably 5 at that point) to work with. 1. What the code does is, I think sound. In each class these variables are defined:

    Private mlErrNumber As Long '** Standard Variable for Error Trapping **
    Private msErrDescription As String '** Standard Variable for Error Trapping **
    Private msErrSource As String '** Standard Variable for Error Trapping **

    Then in any function or sub mlErrNumber = 0 clears the error state. Not bad so far, slightly ott, but not bad. So when an error occured, this was called to persist the error state to be used by any calling classes:

    Private Sub SetError(ByVal alNumber As Long, _
    ByVal asDescription As String, _
    ByVal asSource As String, _
    ByVal asLocation As String)
    '================================================================================================
    ' Sub : SetError
    ' Arguments : alNumber Number of the error
    ' asDescription Description of the error
    ' asSource Source of the original error (Added 1.00.0001)
    ' asLocation Location of the error
    '------------------------------------------------------------------------------------------------
    ' About : Sets the current error.
    ' If mlErrNumber is already set, it just appends to the location
    '================================================================================================

    On Local Error Resume Next
    
    If mlErrNumber = 0 Then
        mlErrNumber = alNumber
        msErrDescription = asDescription
        If asSource = APP\_TITLE Or \_
                asSource = asLocation Or \_
                asSource = "" Then
            msErrSource = ""
        Else
            'It's someone else's error, record where it came from
            msErrSource = " " & asSource
        End If
        Call gObjCommon.SendToLog("E", mlErrNumber, 1, CLASS\_NAME, asLocation, \_
                msErrDescription & IIf(msErrSource = "", "", " \[Occured in" & msErrSource & "\]"))
    End If
    If asLocation <> "" Then
        msErrSource = "." & asLocation & msErrSource
    End If
    

    End Sub

    The horror? Appart from the language, why didn't I see this as being repeated? It's in ~50 seperate classes!


    Panic, Chaos, Destruction. My work here is done.

    M 1 Reply Last reply
    0
    • N Nagy Vilmos

      0. This code is in the region of 10 years old and I only had VB (probably 5 at that point) to work with. 1. What the code does is, I think sound. In each class these variables are defined:

      Private mlErrNumber As Long '** Standard Variable for Error Trapping **
      Private msErrDescription As String '** Standard Variable for Error Trapping **
      Private msErrSource As String '** Standard Variable for Error Trapping **

      Then in any function or sub mlErrNumber = 0 clears the error state. Not bad so far, slightly ott, but not bad. So when an error occured, this was called to persist the error state to be used by any calling classes:

      Private Sub SetError(ByVal alNumber As Long, _
      ByVal asDescription As String, _
      ByVal asSource As String, _
      ByVal asLocation As String)
      '================================================================================================
      ' Sub : SetError
      ' Arguments : alNumber Number of the error
      ' asDescription Description of the error
      ' asSource Source of the original error (Added 1.00.0001)
      ' asLocation Location of the error
      '------------------------------------------------------------------------------------------------
      ' About : Sets the current error.
      ' If mlErrNumber is already set, it just appends to the location
      '================================================================================================

      On Local Error Resume Next
      
      If mlErrNumber = 0 Then
          mlErrNumber = alNumber
          msErrDescription = asDescription
          If asSource = APP\_TITLE Or \_
                  asSource = asLocation Or \_
                  asSource = "" Then
              msErrSource = ""
          Else
              'It's someone else's error, record where it came from
              msErrSource = " " & asSource
          End If
          Call gObjCommon.SendToLog("E", mlErrNumber, 1, CLASS\_NAME, asLocation, \_
                  msErrDescription & IIf(msErrSource = "", "", " \[Occured in" & msErrSource & "\]"))
      End If
      If asLocation <> "" Then
          msErrSource = "." & asLocation & msErrSource
      End If
      

      End Sub

      The horror? Appart from the language, why didn't I see this as being repeated? It's in ~50 seperate classes!


      Panic, Chaos, Destruction. My work here is done.

      M Offline
      M Offline
      Moreno Airoldi
      wrote on last edited by
      #2

      VB kind of forced all of us to a number of little implementation horrors, what with fake OOP and all. :-D I had my share of VB back in the day, and I'm happy it's over! When I have to maintain some of my old code from the 90's I still shiver at some horrors I see. It sure was partly my fault, but I'm convinced VB did its part. We will probably enter yet another phylosophical/religious debate if we start arguing about goods and bads in old VB, but I think (hope) everybody will agree that even if it did have a sense in its day, it was just EVIL. ;P

      2+2=5 for very large amounts of 2 (always loved that one hehe!)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups