APIs for Java Developers
Go to APIs for .NET Developers (coming soon)Class NException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.javonet.JavonetException
-
- com.javonet.api.NException
-
- All Implemented Interfaces:
- java.io.Serializable
public class NException extends JavonetException
This- Since:
- 1.5
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor and Description NException(com.javonet.internal.IGateway gatewayManager,
java.lang.String exInString,
java.lang.String oid,
java.lang.String helpLink,
java.lang.String message,
java.lang.String source,
java.lang.String stackTrace,
int hresult,
java.lang.String exceptionTypeName)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.String
getExceptionString()
Returns entire .NET exception in string including all internal exceptions details.NType
getExceptionType()
Returns the NType object representing .NET type associated with this NException object (type of .NET exception thrown).java.lang.String
getExceptionTypeName()
Returns the name of the exception type associated with this NException object (type of .NET exception thrown).java.lang.String
getHelpLink()
Gets a link to the help file associated with this .NET exception.int
getHResult()
Gets .NET HRESULT, a coded numerical value that is assigned to this exception.NException
getInnerException()
Gets the Exception instance that caused the current exception.java.lang.String
getMessage()
NObject
getRef(java.lang.String fieldName)
Gets value of any field on the exception object on .NET side associated with this NException instance.java.lang.String
getSource()
Gets the name of the application or the object that causes the error on .NET side.java.lang.String
getStackTraceAsString()
Returns .NET stack trace of this exception in string format.
-
Constructor Detail
-
NException
public NException(com.javonet.internal.IGateway gatewayManager, java.lang.String exInString, java.lang.String oid, java.lang.String helpLink, java.lang.String message, java.lang.String source, java.lang.String stackTrace, int hresult, java.lang.String exceptionTypeName)
-
Method Detail
-
getExceptionString
public java.lang.String getExceptionString()
Returns entire .NET exception in string including all internal exceptions details.The result of this method is equivalent of message set on JavonetExceptions in previous exceptions mode.
- Returns:
- returns the entire .NET exception and internal exception in string.
-
getExceptionType
public NType getExceptionType()
Returns the NType object representing .NET type associated with this NException object (type of .NET exception thrown).- Returns:
- NType object representing .NET type associated with this NException object (type of .NET exception thrown).
-
getExceptionTypeName
public java.lang.String getExceptionTypeName()
Returns the name of the exception type associated with this NException object (type of .NET exception thrown).Name is provided as full class name with namespace.
- Returns:
- name of the exception type associated with this NException object.
-
getHelpLink
public java.lang.String getHelpLink()
Gets a link to the help file associated with this .NET exception.The return value, which represents a help file, is a URN or URL.
- Returns:
- link to the help file associated with this .NET exception.
-
getHResult
public int getHResult()
Gets .NET HRESULT, a coded numerical value that is assigned to this exception.HRESULT is a 32-bit value, divided into three different fields: a severity code,
a facility code, and an error code. The severity code indicates whether the return
value represents information, warning, or error. The facility code identifies the
area of the system responsible for the error. The error code is a unique number that
is assigned to represent the exception. Each exception is mapped to a distinct HRESULT.
When managed code throws an exception, the runtime passes the HRESULT to the COM client.
When unmanaged code returns an error, the HRESULT is converted to an exception, which is
then thrown by the runtime. For information about HRESULT values and their corresponding
.NET Framework exceptions, see How to: Map HRESULTs and Exceptions. See Common HRESULT
Values in the Windows documentation for a list of the values you are most likely to encounter.- Returns:
- .NET HRESULT, a coded numerical value that is assigned to this exception.
-
getInnerException
public NException getInnerException()
Gets the Exception instance that caused the current exception.When an exception X is thrown as a direct result of a previous exception Y, the InnerException property of X should contain a reference to Y.
Use the InnerException property to obtain the set of exceptions that led to the current exception.
You can create a new exception that catches an earlier exception. The code that handles the second exception can make use of the additional information from the earlier exception to handle the error more appropriately.
Suppose that there is a function that reads a file and formats the data from that file. In this example, as the code tries to read the file, an IOException is thrown. The function catches the IOException and throws a FileNotFoundException. The IOException could be saved in the InnerException property of the FileNotFoundException, enabling the code that catches the FileNotFoundException to examine the cause of the initial error.
The InnerException property, which holds a reference to the inner exception, is set upon initialization of the exception object.
- Returns:
- NException instance that caused the current exception.
-
getMessage
public java.lang.String getMessage()
- Overrides:
getMessage
in classjava.lang.Throwable
-
getRef
public NObject getRef(java.lang.String fieldName) throws JavonetException
Gets value of any field on the exception object on .NET side associated with this NException instance.- Parameters:
fieldName
– name of the field for which the value should be retrieved.- Returns:
- value of the field specified in fieldName.
- Throws:
JavonetException
– thrown if Javonet error occurs while processing the call.
-
getSource
public java.lang.String getSource()
Gets the name of the application or the object that causes the error on .NET side.If the Source property is not set explicitly, the runtime automatically sets it
to the name of the assembly in which the exception originated.- Returns:
- name of the application or the object that causes the error on .NET side.
-
getStackTraceAsString
public java.lang.String getStackTraceAsString()
Returns .NET stack trace of this exception in string format.- Returns:
- .NET stack trace of this exception in string format.
-