Err object VS. GetLastError()

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

    Err object VS. GetLastError()

    The original programmer of our website put "on error resume next" on
    every page to cover up his lack of skill. Many of our pages are
    returning errors that we never see.

    I want to make a little script that emails me at the occurance of an
    error. I copied one that used the Err object but I don't want to use
    it because I would like line numbers is the email.

    I then copied our custom 500 error page that uses the GetLastError
    function but it always seems to be empty, like no error occurred.

    The function "If Err Then" returns true so the Err object sees the
    error. Why won't GetLastError return the error.
  • Aaron [SQL Server MVP]

    #2
    Re: Err object VS. GetLastError()

    GetLastError can *only* be used within the custom 500 error handler, which
    will only be called if an error actually gets bubbled up to the caller. You
    cannot capture it if you bypass the error using on error resume next -- this
    still allows you to handle the error yourself, which defeats the purpose of
    the 500 handler. It'd be nice to be able to circumvent it, of course, but
    that's nothow it's designed...

    --
    Please contact this domain's administrator as their DNS Made Easy services have expired.

    (Reverse address to reply.)




    "Nick Messick" <nmessick@gmail .com> wrote in message
    news:63ff899c.0 411241611.7193d 6ec@posting.goo gle.com...[color=blue]
    > The original programmer of our website put "on error resume next" on
    > every page to cover up his lack of skill. Many of our pages are
    > returning errors that we never see.
    >
    > I want to make a little script that emails me at the occurance of an
    > error. I copied one that used the Err object but I don't want to use
    > it because I would like line numbers is the email.
    >
    > I then copied our custom 500 error page that uses the GetLastError
    > function but it always seems to be empty, like no error occurred.
    >
    > The function "If Err Then" returns true so the Err object sees the
    > error. Why won't GetLastError return the error.[/color]


    Comment

    Working...