Trap errors - 2nd post

Discussion in 'ASP General' started by Eitan, Jan 12, 2005.

  1. Eitan

    Eitan Guest

    Hello,
    I want to emphasize a point for my prior posts :

    How can I trap a message in ASP (not dotnet), to a specific label.

    (I know : on error goto my_label ...
    but this does not work in ASP pages)

    Thanks :)
    Eitan, Jan 12, 2005
    #1
    1. Advertising

  2. Eitan

    Steven Burn Guest

    Whats wrong with Bob's answer to your other post concerning this?

    --

    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Eitan" <no_spam_please@nospam_please.com> wrote in message
    news:#zQmzfK#...
    > Hello,
    > I want to emphasize a point for my prior posts :
    >
    > How can I trap a message in ASP (not dotnet), to a specific label.
    >
    > (I know : on error goto my_label ...
    > but this does not work in ASP pages)
    >
    > Thanks :)
    >
    >
    >
    Steven Burn, Jan 12, 2005
    #2
    1. Advertising

  3. Eitan wrote:
    > Hello,
    > I want to emphasize a point for my prior posts :
    >
    > How can I trap a message in ASP (not dotnet), to a specific label.
    >
    > (I know : on error goto my_label ...
    > but this does not work in ASP pages)
    >
    > Thanks :)


    One of the links that was provided showed an example, but here's a generic
    example:

    on error resume next
    'bunch of statements
    'statement that may generate an error
    if err <> 0 then
    'handle the error
    response.write err.number & ": " & err.description
    'use Select Case to tailor your action to specific error numbers
    end if
    'turn off error handling if appropriate (this is optional*):
    on error goto 0


    In addition, with ADO, you also can ustilize the connection object's Errors
    collection (you still have to us on error resume next)

    on error resume next
    conn.execute querythatmayproduceerror
    if conn.Errors.count > 0 then
    for each adoerr in conn.errors
    response.write "<BR>ADO Error #" & adoerr.number & "<BR>" & _
    "DB Error #: & ": " & adoerr.nativeError & "<BR>" & _
    "Description: " ": " & adoerr.description
    'use Select Case to tailor your action to specific error numbers
    next
    end if

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jan 12, 2005
    #3
  4. Bob Barrows [MVP] wrote:
    > Eitan wrote:
    >> Hello,
    >> I want to emphasize a point for my prior posts :
    >>
    >> How can I trap a message in ASP (not dotnet), to a specific label.
    >>
    >> (I know : on error goto my_label ...
    >> but this does not work in ASP pages)
    >>
    >> Thanks :)

    >
    > One of the links that was provided showed an example, but here's a
    > generic example:
    >
    > on error resume next
    > 'bunch of statements
    > 'statement that may generate an error
    > if err <> 0 then
    > 'handle the error
    > response.write err.number & ": " & err.description
    > 'use Select Case to tailor your action to specific error numbers
    > end if
    > 'turn off error handling if appropriate (this is optional*):
    > on error goto 0
    >

    This would be better written like this:

    on error resume next
    'bunch of statements whose errors you wish to ignore
    ....
    ....
    ....
    'statement that may generate an error you wish to handle
    err.clear
    ....
    if err <> 0 then
    'handle the error
    response.write err.number & ": " & err.description
    'use Select Case to tailor your action to specific error numbers
    end if
    'turn off error handling if appropriate (this is optional*):
    on error goto 0

    *Eric Lippert wrote a series of blogs about error-handling in vbscript,
    which you can find here:
    http://blogs.msdn.com/ericlippert/category/2528.aspx

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jan 12, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Nolan

    Trap "connection pool" errors

    Sean Nolan, Jul 11, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    392
    David Browne
    Jul 11, 2003
  2. Andrew Banks

    Trap all errors

    Andrew Banks, Apr 22, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    416
    Rick Spiewak
    Apr 23, 2004
  3. Rolf Kemper

    Trap run time errors in XSLT

    Rolf Kemper, Oct 20, 2004, in forum: XML
    Replies:
    0
    Views:
    469
    Rolf Kemper
    Oct 20, 2004
  4. SalP
    Replies:
    3
    Views:
    386
    bruce barker \(sqlwork.com\)
    May 17, 2006
  5. Peter A. Schott

    Best way to trap errors in ftplib?

    Peter A. Schott, Jan 11, 2005, in forum: Python
    Replies:
    1
    Views:
    319
    Mark McEahern
    Jan 12, 2005
Loading...

Share This Page