> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/uwp/learn-more/error-handling.md).

# Displaying full error message when working with UWP

Learn how to handle exceptions effectively in PDFNet with the Apryse SDK for UWP. Get detailed error messages and custom information using the PDFNetException class. Follow this code snippet for bette

It is possible to get more useful error messages when PDFNet throws exceptions.

Due to limitations of the COM API boundary, only System.Exception could be passed from the Apryse SDK to the consuming code. This limited the errors to those that were already defined and prevented custom information to be attached.

To overcome this, Apryse SDK for UWP has a class: [`pdfnet.Common.PDFNetException`](https://sdk.apryse.com/api/uwp/guides/html/c50c96fc-c98c-f7cd-9401-6179e181f3cb.htm) that can be created with an HResult from a System.Exception and will be able to display the information relevant to the error that caused the Exception.

The following code snippet shows an example in how to use the `PDFNetException` class:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
string errText = "NONE";
try
{
	pdftron.PDF.PDFDoc doc = new pdftron.PDF.PDFDoc("not_valid");
}
catch (Exception ex)
{
    pdftron.Common.PDFNetException pdfNetEx = new pdftron.Common.PDFNetException(ex.HResult);
    if (pdfNetEx.IsPDFNetException)
    {
      errText = string.Format("Exeption at line {0} in file {1}", pdfNetEx.LineNumber, pdfNetEx.FileName);
      errText += Environment.NewLine;
      errText += string.Format("Message: {0}", pdfNetEx.Message);
    }
    else
    {
      errText = ex.ToString();
    }
}
MessageDialog errorDialog = new MessageDialog(errText);
await errorDialog.ShowAsync();
```

{% endcode %}
{% endtab %}
{% endtabs %}

This will show what the error message is, and the line and file in which it happened.

This information will be very valuable to us if PDFNet throws an unexpected Exception. If you encounter an Exception while working with the Apryse SDK for UWP, it is a good idea to include the full error from PDFNetException.ToString() with the description of the problem to sent to our support team.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/uwp/learn-more/error-handling.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
