New to Telerik Reporting? Download free 30-day trial

Error handling in Reports and Report Viewers

Environment

Product Progress® Telerik® Reporting
Report Viewer Any Report Viewer

Description

Reports and Report Viewers are created in such manner that errors may not result in system failure, but the end user can still see an error message. It is a common requirement to make these error messages more user-friendly and comprehensive for users.

Telerik Reporting provides mechanisms for custom handling errors, where you can add logic and UI that you want to appear in such cases.

Solution

  1. Errors related to processing items, which do not lead to breaking the report document's generation.

    • If these errors are not handled, the report will be processed and rendered, but there might be red error messages in the report at the place of the items which failed being processed.

    • Such errors can be caught in the report's Error event. If a report is created as a TRDX|TRDP file, you can deserialize|unpackagethe file and subscribe the report instance to its Error event.
      The report's Error event has information about the processing element throwing the exception(sender), and provides arguments allowing you to read the exception and cancel the further processing. If you throw a custom exception in the Error event, the further processing will be stopped, and if you use a Report Viewer, you will receive the custom error message in the viewer's preview.

  2. Errors related to processing items, leading to breaking the report document's generation.

  3. Errors related to the functionality of the instance processing the report (Report Viewers or ReportProcessor).

    • If the error is not breaking the execution of the application, you will be able to use the Error event and localization resources of the corresponding Report Viewer, or the ReportProcessor instance.

    • More serious problems will have to be handled on application level. For example, if there is a configuration problem with the HTML5 Viewer, you can catch requests and response and redirect to an error page.

See Also

Handling errors occurring in a Custom Resolver used by a Reporting REST Service.

In this article