一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - ASP教程 - javascript asp教程錯誤處理

javascript asp教程錯誤處理

2019-10-22 10:20asp技術網 ASP教程

javascript asp教程錯誤處理

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 is with a Server Method. Yeah, I know; it doesn't make sense. Start with something like var myError=Server.GetLastError() and then you 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")
	Response.Write("myError.File: " + myError.File + "\r")
	Response.Write("<HR>\r<STRONG>")
	Response.Write("Now an intentional error...")
	Response.Write("<BR></STRONG>\r")
	myError = erver.GetLastError() //this line causes an error
	Response.Write("myError.Line: " + myError.Line + "<BR>\r")
	Response.Write("myError.File: " + myError.File + "<BR>\r")
	}
catch(myDumbError) 
	{ 
	Response.Write("There is an error: " + myDumbError)
	%>
	<BR>
	Graceful error handling goes here (inside the catch statement).
	Make it as simple or sophisticated as you like.<BR>
	<HR>
	<STRONG>Now let's break down the error Object.</STRONG><BR>
	<%
	for ( var i in myDumbError)
		{
		Response.Write(i + ": " + myDumbError[i] + "<BR>\r")
		}
	}
finally
	{
	Response.Write("<HR><STRONG>Let's Finish Up.</STRONG><BR>\r")
	Response.Write("Code inside the <I>finally { }</I> statement ")
	Response.Write("executes regardless of error (or lack thereof). \r")
	Response.Write("<I>finally{ }</I> is totally optional. ")
	Response.Write("It's a good place for things like RS.Close()... ")
	Response.Write("which you'll see later on.")
	}
%>

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 won't work on the server side. But thanks to some core JavaScript we have some error handling.

The section of script for which you wish to provide error handling goes inside the try { } statements and the what-to-do in the event of an 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 you access to the ASPError Object. So, don't be surprised if ASPError gives you an error.

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 午夜精品久久久久久久99蜜桃 | 大学第一次基本都没了 | 国产一区二区在线观看视频 | 99久久免费精品视频 | 暗卫调教女主肉高h | 夫妇交换小说全文阅读 | free service性v极品| 国产私人影院 | 火影忍者小南裸羞羞漫画 | 1769亚洲欧美资源站 | 小泽玛丽av无码观看 | 黑人女性猛交xxxxxⅹxx | 午夜办公室在线观看高清电影 | 贰佰麻豆剧果冻传媒一二三区 | 女bbwxxxx非洲黑人 | 四虎影院在线免费观看 | 久久免费国产视频 | 香蕉久久ac一区二区三区 | 国产精品美女久久久久网站 | 日本黄视频在线播放 | 精品日韩欧美一区二区三区在线播放 | 明星乱淫 | 国产成人免费观看在线视频 | 亚洲网色 | 美女mm131爽爽爽久久 | 久久精品一卡二卡三卡四卡视频版 | 国产精品片 | 免费高清资源黄网站在线观看 | 2019天天干天天操 | 国产九九在线观看播放 | 色人阁图片| 激情三级hd中文字幕 | 69成人影院| 国产情侣偷国语对白 | 国产成人啪精品午夜在线播放 | 男女男在线精品网站免费观看 | 性bbwbbwbbwbbw撒尿 | 大东北chinesexxxx露脸 | 日本免费一二区 | 精品久久久久久国产 | 色婷婷精品 |