How to throw error from jsreport engine if it fails to render report (Rendering async report)?
-
Hi sir,
We are rendering our report asynchronously using jsreport-browser client package from our angular application.
Since the report rendering is asynchronous a url will be return like this,Async rendering in progress. Use Location response header to check the current status. Check it <a href='http://localhost:5488/reports/624eadda935011c1881550db/status'>here</a>
And after that using afterRender hook we send a message to our client side that report rendering is completed using AWS websocket and SNS).
But my doubt is, if report render fails at beforeRender hook itself then how to throw the error from beforeRender hook to our client side ,because now jsreport-browser-client is returning only url like this,
Async rendering in progress. Use Location response header to check the current status. Check it <a href='http://localhost:5488/reports/624eadda935011c1881550db/status'>here</a>
Could you please suggest any solution?
-
-
I have written sub function inside before render , suppose if there is any exception comes in any of those subfunction then how can i throw those error from jsreport to the client?
Could you please show me one example which handle exception inside jsreport and throw those error to client.Actually the exception is shown in jsreport terminal while rendering renport from localhost (In AWS error is shown in cloudwatch log) but my issue is how to throw this error from jsreport log to client side?jsreport-browser-client package is we are using to render our report from angular application.
Could you please suggest me any solution?
-
-
It's an async report, where the client can find out the state of the report only by checking the provided URL in the Location header. It is the same you see here:
Async rendering in progress. Use Location response header to check the current status. Check it <a href='http://localhost:5488/reports/624eadda935011c1881550db/status'>here</a>
If you http GET that URL, you get the status of the report. If the report fails, the response header contains Report-State:error. In this case, you can just read the response and get the error message.
-
Thank you sir