Click or drag to resize

PDFNetException Class

A utility class that helps in getting more detailed exception and error messages when working with PDFNetWinRT.
Inheritance Hierarchy
SystemObject
  pdftron.CommonPDFNetException

Namespace:  pdftron.Common
Assembly:  pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax
public sealed class PDFNetException : IStringable

The PDFNetException type exposes the following members.

Constructors
  NameDescription
Public methodPDFNetException
Creates a new PDFNetException based on an existing Exception.
Top
Properties
  NameDescription
Public propertyCondExpr
Gets the conditional expression that triggered the exception to be thrown.
Public propertyErrorCode
Gets the associated error code, if any, with this exception.
Public propertyFileName
Gets the filename from where the exception was thrown.
Public propertyFunction
Gets the name of the function/method where the exception was thrown.
Public propertyIsPDFNetException
Gets whether this exception is a PDFNet exception.
Public propertyLineNumber
Gets the line number in the file where the exception was thrown.
Public propertyMessage
Gets the detailed message describing the exception.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetCondExpr
Gets the conditional expression that triggered the exception to be thrown.
Public methodGetErrorCode
Gets the associated error code, if any, with this exception.
Public methodGetFileName
Gets the filename from where the exception was thrown.
Public methodGetFunction
Gets the name of the function/method where the exception was thrown.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLineNumber
Gets the line number in the file where the exception was thrown.
Public methodGetMessage
Gets the detailed message describing the exception.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string representation of this exception.
Top
Remarks

PDFNetException is only a utility class for getting more useful error messages from PDFNet. Because PDFNetException does not inherit from Exception class, it can never be caught. In order to see more detailed error/exception messages, it is recommended to create a new PDFNetException instance from a caught Exception instance's HResult value.

If the caught exception is not associated with any PDFNet specific exceptions, all methods will return default values based on the caught exception (i.e. the exception message). In this case, the original exception can be obtained by calling the GetPlatformException() method.

Examples
This sample code shows how to work with PDFNetException class for handling exceptions.
try {
    // do something...
}
catch (Exception e) {
    // Get the associated PDFNetException from the hresult, if any
    PDFNetException pdfnetEx = new PDFNetException(e.HResult);
    // Get useful error message
    pdfnetEx.ToString();
}
See Also