# GrapeCity.ActiveReports.Viewer.Win.Viewer.ErrorOccured

## Content

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




<h1 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_ErrorOccured" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.ErrorOccured" class="text-break">ErrorOccured Event
</h1>
<div class="markdown level0 summary"><p>Occurs when an error occurs within the viewer. This event provides detailed information about the error,
allowing for custom error handling or logging.</p>
</div>
<div class="markdown level0 conceptual"></div>
<h6><strong>Namespace</strong>: <a class="xref" href="GrapeCity.ActiveReports.Viewer.Win.html">GrapeCity.ActiveReports.Viewer.Win</a></h6>
<h6><strong>Assembly</strong>: MESCIUS.ActiveReports.Viewer.Win.dll</h6>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_ErrorOccured_syntax">Syntax</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public event EventHandler&lt;ErrorInfo&gt; ErrorOccured</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.eventhandler-1">EventHandler</a>&lt;<a class="xref" href="../MESCIUS.ActiveReports.Viewer.Common/GrapeCity.Viewer.Common.Model.ErrorInfo.html">ErrorInfo</a>&gt;</td>
      <td>Occurs when an error occurs within the viewer. This event provides detailed information about the error, allowing for custom error handling or logging.</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_ErrorOccured_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p>The <a class="xref" href="../MESCIUS.ActiveReports.Viewer.Common/GrapeCity.Viewer.Common.Model.ErrorInfo.html">ErrorInfo</a> object passed as a parameter to the event handler contains details about the error, including the exception object,
a user-friendly message, and potentially other metadata related to the error condition.
Subscribing to this event allows applications to gracefully handle errors, such as displaying custom error messages to the user,
logging errors for diagnostics, or implementing specific recovery actions based on the type or severity of the error.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_ErrorOccured_examples"><strong>Examples</strong></h5>
<pre><code class="lang-csharp">viewer.ErrorOccured += (sender, e) =&gt;
{
    // Log error details
    Console.WriteLine($"Error: {e.Exception.Message}");
    // Show a user-friendly message
    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
};</code></pre>

</div>
