468,514 Members | 1,029 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,514 developers. It's quick & easy.

Trapping errors in ASP

Hello,
I need an example of "Trapping Errors" in ASP (not .net)

Thanks :)
Jul 22 '05 #1
6 2293
"Eitan" <no_spam_please@nospam_please.com> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
Hello,
I need an example of "Trapping Errors" in ASP (not .net)

Thanks :)

<%
'test.asp
'Error Trap
On Error Resume Next
Response.Write 0/0
If Err.Number <> 0 Then
Response.Write Err.Description
Else
Response.Write "No Error Found"
End If

Response.End
%>
Jul 22 '05 #2
Can I trap on specific label, and not after the error occured.
(I know : on error goto my_label ...
but this does not work in ASP pages)
Thanks :)
Jul 22 '05 #3
On Wed, 12 Jan 2005 12:10:58 +0200, "Eitan"
<no_spam_please@nospam_please.com> wrote:
Can I trap on specific label, and not after the error occured.
(I know : on error goto my_label ...
but this does not work in ASP pages)


Actually, you can never trap on an error that doesn't occur. :)

Use the same setup, and either handle the error instead of
Response.Write'ing it out, or call a function to handle the error and
return whatever you need to continue processing. You can even handle
errors based on the error number.

I used to have a link to a document on either ASPFaq or 4GuysFromRolla
about error trapping, but it's not in my links (or I saved the link on
another system...). A search on both doesn't really turn up what I
remmbered, but there's info out there.

Jeff
Jul 22 '05 #4
Eitan wrote:
Can I trap on specific label, and not after the error occured.
(I know : on error goto my_label ...


No.
http://msdn.microsoft.com/library/en...stmonerror.asp

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #5
Can I trap on specific label, and not after the error occured.
(I know : on error goto my_label ...
but this does not work in ASP pages)


Actually, you can never trap on an error that doesn't occur. :)


You didnt understand me.
I meant that : the error occurred, but I don't want just after line that
cause the error, but to goto a specific label.
(on "error goto my_label" doesn't work on asp, but only on VB, and "on error
resume next" is not what I am searching for).

'Thanks :)
Jul 22 '05 #6
Eitan wrote:
Can I trap on specific label, and not after the error occured.
(I know : on error goto my_label ...
but this does not work in ASP pages)
Actually, you can never trap on an error that doesn't occur. :)


You didnt understand me.
I meant that : the error occurred, but I don't want just after line
that cause the error, but to goto a specific label.
(on "error goto my_label" doesn't work on asp,


correction: not "asp", asp is not a language. It is a platform supporting
multiple scripting languages, including vbscript (which is what I'm sure you
meant to say instead of "asp", right?), jscript, etc.
but only on VB, and
"on error resume next" is not what I am searching for).

'Thanks :)


Sorry, but that's the only game in town when using vbscript. As somebody
else said, you can switch to using jscript in your server-side code,
allowing you to use try...catch...finally.

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"
Jul 22 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Thelma Lubkin | last post: by
2 posts views Thread by Fred Nelson | last post: by
2 posts views Thread by Captain Nemo | last post: by
9 posts views Thread by 47computers | last post: by
1 post views Thread by asearle | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.