This is a migrated thread and some comments may be shown as answers.

Custom Report Resolver exception

3 Answers 493 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Petteri
Top achievements
Rank 1
Petteri asked on 26 Mar 2015, 09:24 AM
I have a custom report resolver that implements IReportResolver.Resolve(string). The execution of this method does quite a few things that can go wrong in my setup. I catch and log the exceptions but throwing it will always cause the reporting service to hide the actual exception and will replace it with a generic "Unable to get report parameters: Report 'reportId' cannot be resolved."

How can I display the actual exception to the user (I'm using the html5 report viewer)?

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 30 Mar 2015, 05:44 AM
Hello Petteri,

In general, the custom resolver's Resolve method will receive the string description of the report requested  by the client(viewer).

For example, if the viewer's reportSource.Report is set to "MyReport", the resolve method will receive the "MyReport" string and then you need to handle the report retrieval on the server. The obtained report's XML, file or type must be wrapped in a report source object.


In order to investigate the problem, please paste the logic of the custom resolver. Feel free to open a support ticket and send us a demo project as an attachment.

Regards,
Stef
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Petteri
Top achievements
Rank 1
answered on 08 Apr 2015, 06:13 AM

The custom resolver does indeed get a report identifier as a string along with some options. According to the options, it fetches some data and sets data sources to various sections of the report being resolved finally returning an instanceReportSource with the resolved report as it's ReportDocument.

The whole thing is wrapped in a

try{ 

  // resolve the report

} catch (Exception e) {

  // log the error, then
  throw e;

}

So I get a descrptive exception of what went wrong in the log, but the report viewer seems to hide the exception so that whatever is thrown, the user will always see "Unable to get report parameters: Report 'reportId' cannot be resolved.".

Is there something I can override to change this?

0
Stef
Telerik team
answered on 10 Apr 2015, 02:18 PM
Hi Petteri,

Errors on report resolving in the service's resolver method, can be logged on the server. If the Resolver does not return a backup report, there will be an error that the sent from the viewer description cannot be resolved. This can be caught at the client:
$(document).ready(function () {
       $("#reportViewer1")
           .telerik_ReportViewer({
               serviceUrl: "api/reports/",
               templateUrl: 'ReportViewer/templates/telerikReportViewerTemplate-9.0.15.324.html',
               reportSource: {
                   report: "Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary",
                   parameters: { }
               },
               viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
               scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
               scale: 1.0,
              error: function (e, args) {
                    $('.trv-error-pane').toggle();
                   alert('The error indicates an issue with the report processing:\r\n' + args);
               }
           });
   });


Error during report processing, means the report is resolved and now it is processed with the data. You can subscribe in the report for its Error event and provide custom handling for errors occurring on report processing.
The error will occur on the server, and will be transferred to the client(viewer), where you can handle it again in the viewer's error event.


I hope this information helps you.

Regards,
Stef
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
General Discussions
Asked by
Petteri
Top achievements
Rank 1
Answers by
Stef
Telerik team
Petteri
Top achievements
Rank 1
Share this question
or