'Declaration Public Event ErrorOccured As EventHandler(Of ErrorInfo)
public event EventHandler<ErrorInfo> ErrorOccured
Event Data
The event handler receives an argument of type ErrorInfo containing data related to this event. The following ErrorInfo properties provide information specific to this event.
Property | Description |
---|---|
Detail | Gets a value indicating the detailed error information. |
Exception | Gets a value indicating the exception associated with the error, if any. |
Info | Gets a value indicating the general error information. |
Severity | Gets a value indicating the severity level of the error. |
Remarks
The GrapeCity.Viewer.Common.Model.ErrorInfo 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.
Example
viewer.ErrorOccured += (sender, e) => { // Log error details Console.WriteLine($"Error: {e.Exception.Message}"); // Show a user-friendly message MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); };
See Also