Main Content

NET.NetException

Capture error information for .NET exception

    Description

    Process information from aNET.NetExceptionobject to handle .NET errors. This class is derived fromMException.

    Creation

    Description

    example

    e= NET.NetException(msgID,errMsg,netObj)constructs instanceeofNET.NetExceptionclass.

    Input Arguments

    expand all

    Message identifier, specified as a string or a character vector.

    Error message text, specified as a string or a character vector.

    .NET object that caused the exception, specified as aSystem.Exceptionobject.

    Properties

    expand all

    Class causing the error, specified as aSystem.Exceptionobject.

    Object Functions

    See the object functions ofMException.

    Examples

    collapse all

    Display error information after trying to load an unknown assembly.

    tryNET.addAssembly('C:\Work\invalidfile.dll')catche e.message;if(isa(e,'NET.NetException')) eObj = e.ExceptionObjectendend
    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]

    Version History

    Introduced in R2009b

    See Also