Err.Number And Exceptions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hooligan

    Err.Number And Exceptions

    I have this ancient application that was originally created in VB4 and
    has been upgraded and upgraded. The application is massive and uses
    the Err object and the owners will not pay for a rewrite of the error
    handling (why would they it works).

    With new code additions I use try-catch-err.raise and although it
    works I'm uncomfortable with mixing err object and exceptions.

    try
    ......
    catch
    err.raise
    end try

    I created a subclass of exception so that I could throw a custom
    exception instead of using err.raise. In this subclass I set the
    HResult as this appears to correspond to err.number, however when I
    throw this exception the resulting err.number always becomes 5 no
    matter what I set it to.

    Does anyone know if it is possible to set err.number when using an
    exception?
Working...