Custom Report Resolver exception

4 posts, 0 answers
  1. Petteri
    Petteri avatar
    9 posts
    Member since:
    Jan 2015

    Posted 26 Mar 2015 Link to this post

    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)?
  2. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 30 Mar 2015 Link to this post

    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.

     
  3. Petteri
    Petteri avatar
    9 posts
    Member since:
    Jan 2015

    Posted 08 Apr 2015 in reply to Stef Link to this post

    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?

  4. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 10 Apr 2015 Link to this post

    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.

     
Back to Top