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

How to get internal error message from Custom Report Resolver

12 Answers 777 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Tursunkhuja asked on 18 Dec 2019, 06:54 AM

Hello,
I am working with Reporting using HTML5 Report Viewer. I have designed Custom Report Resolver for showing up the reports. My reports have WebServiceDatasource that use OData to load data from database. Sometimes OData can through an exception. For example, When OData request select a property which doesn't exist in requested table, then there is error in OData saying like: "Could not find a property named 'NewProperty' on type 'EntityType'".

Custom Report Resolver also through exception, because there is error in OData. But, custom report resolver showing error message with this text: "Response status code does not indicate success: 500 (Internal Server Error)".

I need real error message. Can someone know how to get internal error message as the OData error message?

12 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 20 Dec 2019, 03:10 PM

Hi Tursunhuja,

We will need the following materials in order to provide any ideas:

- screenshot when the error is thrown in OData;

- screenshot when "Response status code does not indicate success: 500 (Internal Server Error)" is thrown;

- the code of the CustomReportResolver;

Regards,
Neli
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 23 Feb 2021, 06:51 AM

I've created the test report with WebServiceDataSource. In the WebServiceDataSource, I'm using OData query. The OData selecting a property which doesn't exist in requested entity, in database. When previewing the report Telerik reporting engine providing its own error that you can see it from the attached picture (TestReportWithError.png). But, that error is not clear (understandable).

When I run my project in debug mode, OData side throwing this exception: "Could not find a property named 'Subtitle1' on 'Model.Entities.Test_Product' entity" (see the attached picture 2 - ErrorThrownInOData.PNG). I want to show only this message of the odata exception on the report content instead of showing that unknown reporting error(picture 1). I tried to use Error event of Telerik.Reporting.Report object (see the attached picture 3,4 - TelerikReport_ErrorEvent1, TelerikReport_ErrorEvent2). But, the exception says about error 422. Is the any solutions to achieve our goal?

(Our custom report resolver does read a requested report from DB and also override some report parameters values.)

0
Neli
Telerik team
answered on 26 Feb 2021, 09:48 AM

Hi Tursunhuja,

Basically, in the report itself, you cannot modify the error because eventArgs.Exception has only a getter and no setter. If you wish, you can lof an FR in our Feedback portal.

You may test using the code below to override the message in the viewer:

private void ListBoundReport_Error(object sender, ErrorEventArgs eventArgs)
        {​​​​​​​
            var errorText = eventArgs.Exception.InnerException is null ? "No Internal" : eventArgs.Exception.InnerException.Message;
            var newMessage = eventArgs.Exception.Message + " inner: " + errorText;
            System.Exception newError = new System.Exception(newMessage);
            throw (newError);
        }​​​​​​​

Let us know if you have any questions.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 02 Mar 2021, 04:11 AM
I don't need to overwrite report's error message. I can create new exception as you wrote or I can create a message. But, my question was how to get an exception that odata throws? (See my scenario above). User doesn't understand 422 error. We should show what was the real problem. In this case we should show odata exception somehow. How can I do that?
0
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 02 Mar 2021, 04:13 AM
Showing a message to user is not problem for me. My problem is how to get odata exception.
0
Neli
Telerik team
answered on 05 Mar 2021, 09:18 AM

Hi Tursunhuja,

Basically, the Error event of the report has an inner exception which you can use. For example:

eventArgs.Exception.InnerException.Message

Note that we display the error message that we receive from the data provider.

I hope this information helps you. Please, let me know if I can help you further.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Doniyor
Top achievements
Rank 1
answered on 30 Mar 2021, 10:07 AM
@Neli     
0
Doniyor
Top achievements
Rank 1
answered on 30 Mar 2021, 10:11 AM
@Neli. DataProvider will send the error message in http response. Is there way to get response that data provider sent? Basically we need to get https response.  
0
Neli
Telerik team
answered on 05 Apr 2021, 10:55 AM

Hi Doniyor,

You may test using the approach from the error(e, args) article. For example:

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 19 Apr 2021, 08:34 AM

Hi Neli,
I followed the link error(e, args) which you sent. That function (error: function) just use an error which sent by Telerik Reporting server side. So, this is not solving our problem.
To reproduce this problem we used "CSharp.Net5.Html5IntegrationDemo" project. We created test report (TestReportWithWebServiceDataSource.trdp), added Web Service DataSource and set this OData query for its Service Url:

https://services.odata.org/V3/Northwind/Northwind.svc/Products(1)?$select=ProductName1

If you see the query, it is selecting "ProductName1" property of "Product #1". But "ProductName1" property does not exist (correct property name is "ProductName"). When we use Postman for the OData query above, it shows an error which you can see from attached picture (ErrorWhenWeUsePostman.PNG, "Could not find a property named 'ProductName1' on type 'NorthwindModel.Product'"). From the second picture (TelerikReportingGeneralError.PNG) you can see the result of my test report (in html5 report viewer) that has the same OData query.

The question is when we preview our report (in html5 report viewer) how can we show the error message that OData sent instead of showing Telerik reporting general error?
Instead of this message:
Unable to get report parameters.
Report 'TestReportWithWebServiceDataSource.trdp' cannot be resolved.

This OData error message should be handled and shown on browser (html5 report viewer) when previewing report:
Could not find a property named 'ProductName1' on type 'NorthwindModel.Product'

FYI: We are using Telerik Reporting version 15.0.21.224.

Thank you,

0
Neli
Telerik team
answered on 26 Apr 2021, 11:51 AM

Hello Tursunhuja,

The R1 2020 Service Pack of Telerik Reporting introduced a couple of changes in the rendering engine. The rendering engine is now forced to skip all pages that do not contain significant content. I suspect that the real error is hidden behind the "No Page To Display" message. For that reason, I would suggest setting the SkipBlankPages property of the report to False. 

For more information, you can visit our blog post - Telerik Reporting & Report Server R1 2021 SP: Improved Rendering, Web Report Designer & More

I have tested the following scenario: in a project that hosts the WebServiceDataSource, I made a small change which makes the service not working. When I ran the application, I got the following error:

{​​​​​​​​"Message":"An error has occurred.","ExceptionMessage":"Could not find file 'D:\\SPECIAL ticket projects\\MyWebService\\MyWebServiceDataSource\\Data\\jsonData1.txt'.","ExceptionType":"System.IO.FileNotFoundException","StackTrace":" at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)\r\n at System.IO.StreamReader..ctor(String path)\r\n at MyWebServiceDataSource.Controllers.DataController.Get() in D:\\SPECIAL ticket projects\\MyWebService\\MyWebServiceDataSource\\Controllers\\DataController.cs:line 18\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"}​​​​​​​​

Then, in the Standalone designer, I got:

 System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
   at Telerik.Reporting.Processing.WebServiceDataSource.WebServiceClient.SendCore(IWebServiceRequestSettings settings, AuthenticationHeaderValue authHeader, HttpClient httpClient, HttpClientHandler httpClientHandler)
   at Telerik.Reporting.Processing.WebServiceDataSource.WebServiceClient.Request(WebServiceDataSource processedDS)
   at Telerik.Reporting.Processing.WebServiceDataSource.WebServiceDataProvider.GetRemoteRawData(WebServiceDataSource processedDS)
   at Telerik.Reporting.Processing.WebServiceDataSource.WebServiceDataProvider.get_RawData()
   at Telerik.Reporting.Processing.WebServiceDataSource.WebServiceSchemaAdapter.AddDataMeasures(SimpleDataModel model)
   at Telerik.Reporting.Processing.Data.SimpleSchemaAdapterBase.Fill(SimpleDataModel model)
   at Telerik.Reporting.Processing.Data.SimpleDataProvider`1.GetSchemaCore()
   at Telerik.Reporting.Processing.Data.DataProvider`1.Telerik.Reporting.Processing.Data.IDataProvider.GetSchema()
   at Telerik.Reporting.Data.Design.DataSourceService.GetLocalSchema(IDataSource datasource, IDataProviderContext dataProviderContext)
   at Telerik.Reporting.Data.Design.DataSourceDesignerBase.Telerik.Reporting.Design.Interfaces.IDataSchemaProvider.GetSchema()
   at Telerik.Reporting.Data.Design.DataSourceService.GetSchemaFromContext(Object context)
   at Telerik.Reporting.Data.Design.DataSourceService.Telerik.Reporting.Design.Interfaces.IDataSourceService.GetCurrentDataItemSchema(Boolean getFromParentRecursively)
   at Telerik.Reporting.Design.DataExplorerControl.<>c__DisplayClass2.<RefreshDataSource>b__0()

I am afraid that currently, it is not possible to get the error from the service and for that reason, I would recommend logging a Feature Request on our Feedback portal.

 

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 27 Apr 2021, 04:13 AM

Hello Neli,

According to your suggestion I created this feature request: How to get report internal error message

Thank you.

Tags
General Discussions
Asked by
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Neli
Telerik team
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Doniyor
Top achievements
Rank 1
Share this question
or