Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Trap errors - 2nd post

Reply
Thread Tools

Trap errors - 2nd post

 
 
Eitan
Guest
Posts: n/a
 
      01-12-2005
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



 
Reply With Quote
 
 
 
 
Steven Burn
Guest
Posts: n/a
 
      01-12-2005
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
>
>
>



 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-12-2005
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"


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-12-2005
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"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to trap errors on file uploads? SalP ASP .Net 3 05-17-2006 04:34 PM
Trap run time errors in XSLT Rolf Kemper XML 0 10-20-2004 07:07 AM
Trap all errors Andrew Banks ASP .Net 3 04-23-2004 03:39 AM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
Trap "connection pool" errors Sean Nolan ASP .Net 1 07-11-2003 02:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57