<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Send custom error messages]]></title><description><![CDATA[<p>Hi,<br />
I am trying to send custom error from jsReport. It sends the error back with status code 500 and message as undefined. In beforeRender(), I added  new Error(&quot;No data&quot;) and I was hoping I would catch an error with 'No data' message but I get back error with status code 500 and message as undefined. What can I do differently?</p>
<p>Thank you,<br />
Rashmi</p>
<p>error in getting quarterly details report:{&quot;_body&quot;:{},&quot;status&quot;:500,&quot;ok&quot;:false,&quot;statusText&quot;:&quot;Internal Server Error&quot;,&quot;headers&quot;:{&quot;access-control-allow-origin&quot;:[&quot;*&quot;],&quot;date&quot;:[&quot;Wed&quot;,&quot; 14 Feb 2018 17:23:32 GMT&quot;],&quot;etag&quot;:[&quot;W/&quot;2b6-959FsY0YsdYAOKAAaPKwRYH3Oe0&quot;&quot;],&quot;connection&quot;:[&quot;keep-alive&quot;],&quot;x-powered-by&quot;:[&quot;Express&quot;],&quot;content-length&quot;:[&quot;694&quot;],&quot;content-type&quot;:[&quot;application/json; charset=utf-8&quot;]},&quot;type&quot;:2,&quot;url&quot;:&quot;<a href="http://localhost:3000/reporting/api/report" rel="nofollow">http://localhost:3000/reporting/api/report</a>&quot;}</p>
<pre><code class="language-js">beforeRender(req,res,done){
if (body[0] === undefined){
           done(new Error(&quot;No data&quot;));
        }
}
</code></pre>
]]></description><link>https://forum.jsreport.net/topic/414/send-custom-error-messages</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 14:57:31 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/414.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Feb 2018 17:31:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Send custom error messages on Thu, 15 Feb 2018 07:52:45 GMT]]></title><description><![CDATA[<p>Hi,<br />
I am trying to send custom error from jsReport. It sends the error back with status code 500 and message as undefined. In beforeRender(), I added  new Error(&quot;No data&quot;) and I was hoping I would catch an error with 'No data' message but I get back error with status code 500 and message as undefined. What can I do differently?</p>
<p>Thank you,<br />
Rashmi</p>
<p>error in getting quarterly details report:{&quot;_body&quot;:{},&quot;status&quot;:500,&quot;ok&quot;:false,&quot;statusText&quot;:&quot;Internal Server Error&quot;,&quot;headers&quot;:{&quot;access-control-allow-origin&quot;:[&quot;*&quot;],&quot;date&quot;:[&quot;Wed&quot;,&quot; 14 Feb 2018 17:23:32 GMT&quot;],&quot;etag&quot;:[&quot;W/&quot;2b6-959FsY0YsdYAOKAAaPKwRYH3Oe0&quot;&quot;],&quot;connection&quot;:[&quot;keep-alive&quot;],&quot;x-powered-by&quot;:[&quot;Express&quot;],&quot;content-length&quot;:[&quot;694&quot;],&quot;content-type&quot;:[&quot;application/json; charset=utf-8&quot;]},&quot;type&quot;:2,&quot;url&quot;:&quot;<a href="http://localhost:3000/reporting/api/report" rel="nofollow">http://localhost:3000/reporting/api/report</a>&quot;}</p>
<pre><code class="language-js">beforeRender(req,res,done){
if (body[0] === undefined){
           done(new Error(&quot;No data&quot;));
        }
}
</code></pre>
]]></description><link>https://forum.jsreport.net/post/2052</link><guid isPermaLink="true">https://forum.jsreport.net/post/2052</guid><dc:creator><![CDATA[rashmim00]]></dc:creator><pubDate>Thu, 15 Feb 2018 07:52:45 GMT</pubDate></item><item><title><![CDATA[Reply to Send custom error messages on Thu, 15 Feb 2018 08:03:37 GMT]]></title><description><![CDATA[<p>The returned error response body is JSON. Parse is it and you get the following structure.</p>
<pre><code class="language-js">{ 
  message: 'Error during rendering report: No data',
  stack: 'Error: No data\n    at beforeRender (evalmachine.&lt;anonymous&gt;:2:10)\n    at evalmachine.&lt;anonymous&gt;:4:111\n    at ContextifyScript.Script.runInContext (vm.js:59:29)\n    at ContextifyScript.Script.runInNewContext (vm.js:65:15)\n    at Object.runInNewContext (vm.js:135:38)\n    at module.exports (E:\\work\\temp\\jsrtest\\node_modules\\jsreport-scripts\\lib\\scriptEvalChild.js:123:6)\n    at process.&lt;anonymous&gt; (E:\\work\\temp\\jsrtest\\node_modules\\script-manager\\lib\\worker-processes.js:48:36)\n    at emitTwo (events.js:125:13)\n    at process.emit (events.js:213:7)\n    at emit (internal/child_process.js:774:12)' 
}
</code></pre>
]]></description><link>https://forum.jsreport.net/post/2056</link><guid isPermaLink="true">https://forum.jsreport.net/post/2056</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Thu, 15 Feb 2018 08:03:37 GMT</pubDate></item></channel></rss>