# GrapeCity.ActiveReports.Viewer.Win.Viewer.HandleError

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_HandleError_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.HandleError*">HandleError Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_Viewer_Win_Viewer_HandleError_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.HandleError*"></a>
<h4 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_HandleError_System_Exception_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.HandleError(System.Exception)">HandleError(Exception)</h4>
<div class="markdown level1 summary"><p>Handles runtime errors by reporting them to the viewer's model for appropriate action.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void HandleError(Exception ex)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a></td>
      <td><span class="parametername">ex</span></td>
      <td><p>The exception that occurred during runtime.
This exception is passed to the viewer model for processing and potentially displaying an error message to the user.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_HandleError_System_Exception__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method is intended to centralize error handling within the viewer control.
It allows for a consistent approach to managing exceptions, such as logging errors or informing the user through the UI.
The actual handling strategy is implemented within the viewer model.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_HandleError_System_Exception__examples">Examples</h5>
<pre><code class="lang-csharp">// Instantiating the Viewer control and adding it to a form.
Viewer viewer = new Viewer();
viewer.Dock = DockStyle.Fill;
this.Controls.Add(viewer);
// Example of handling an error that might occur during document loading.
try
{
    viewer.LoadDocument("path/to/your/report.rdlx");
}
catch (Exception ex)
{
    viewer.HandleError(ex);
}</code></pre>

</div>
