The ASPError Object has zero (0) Methods, nine (9) Properties, zero (0) Events, and zero (0) collections.
ASPCode |
ASPDescription |
Category |
Column |
Description |
File |
Line |
Number |
Source |
The way you access the ASPError Properties are with a Server method. Yeah, I know; It doesn ' t make sense. Start with something like var myerror=server.getlasterror () And then can access all nine ASPError Properties following this pattern: <%=myError.Line%> .
Below is the script for Lesson 15.
<% @LANGUAGE = "JavaScript"%> <!--METADATA type= "typelib" file= "C:\Program Files\Common" files\system\ado\ Msado15.dll "--> <% try {Response.Write (" <strong>use <i>getlasterror () </i><br></ Strong>\r ") Myerror = Server.GetLastError () Response.Write (" Myerror.line: "+ myerror.line +" <BR>\r ") Respons E.write ("Myerror.file:" + myerror.file + "\ r") Response.Write ("<HR>\r<STRONG>") Response.Write ("Now int Entional error ... ") Response.Write (" <br></strong>\r ") Myerror = erver. GetLastError ()//this line causes a error Response.Write ("Myerror.line:" + myerror.line + "<br>\r") Response.wri Te ("myerror.file:" + myerror.file + "<br>\r")} catch (Mydumberror) {Response.Write ("There is a error:" + my
Dumberror)%> <BR> graceful error handling goes here (inside the catch statement). Make it as simple or sophisticated as your like.<br> <HR> <strong>now let's break doWN the error object.</strong><br> <% for (var i in Mydumberror) {Response.Write (i + ":" + mydumber Ror[i] + "<br>\r")}} finally {Response.Write ("
Click here to run the script in a new window.
Okay, so what happened to on Error Resume Next? Sorry, that Ain ' t no JavaScript thing. So, what about onerror? That's won ' t work on the server side. But to some core JavaScript we have some error handling.
The section's script for which your wish to provide error handling goes inside the try {} statements and the WHA T-to-do in the event of a error goes inside the catch {} statement. There is also a finally {} statement (optional). The whole thing is just as graceful as on Error (in my opinion).
Not every ASP server allows for access to the ASPError Object. So, don ' t is surprised if ASPError gives you an error.