NET.NetException
捕获 .NET 异常的错误信息
说明
捕获来自 NET.NetException
对象的信息以处理 .NET 错误。此类派生自 MException
。
创建对象
输入参量
msgID
— 消息标识符
字符串标量 | 字符向量
消息标识符,指定为字符串或字符向量。
errMsg
— 错误消息文本
字符串标量 | 字符向量
错误消息文本,指定为字符串或字符向量。
netObj
— .NET 对象
System.Exception
导致异常的 .NET 对象,指定为 System.Exception
对象。
属性
ExceptionObject
— 导致错误的类
System.Exception
导致错误的类,指定为 System.Exception
对象。
对象函数
请参阅 MException
的对象函数。
示例
加载未知程序集
试图加载未知程序集后显示错误信息。
try NET.addAssembly('C:\Work\invalidfile.dll') catch e e.message; if(isa(e, 'NET.NetException')) eObj = e.ExceptionObject end end
ans = Message: Could not load file or assembly 'file:///C:\Work\invalidfile.dll' or one of its dependencies. The system cannot find the file specified. Source: mscorlib HelpLink: eObj = FileNotFoundException with properties: Message: [1x1 System.String] FileName: [1x1 System.String] FusionLog: [1x1 System.String] Data: [1x1 System.Collections.ListDictionaryInternal] InnerException: [] TargetSite: [1x1 System.Reflection.RuntimeMethodInfo] StackTrace: [1x1 System.String] HelpLink: [] Source: [1x1 System.String]
版本历史记录
在 R2009b 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)