This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Nov 21, 2011, 2:35 AM
1 Posts

How to get the error line by try...catch... in SSJS?

  • Category: Server Side JavaScript
  • Platform: Linux
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 4
In SSJS, I have no idea to get this valuable information... is it possible?
Thanks Victor.
Nov 21, 2011, 9:20 AM
272 Posts
Re: How to get the error line by try...catch... in SSJS?
Hi,
 
try this:
 
try{
    /* Your code */
}catch(e){
    e.getErrorLine();
}
 
Hope this helps
Sven
 
http://blog.hasselba.ch
Nov 22, 2011, 3:12 PM
38 Posts
Re: How to get the error line by try...catch... in SSJS?
 Good point Sven. It should be common use of using the try and catch clause in SSJS, like Java.
Nov 23, 2011, 9:26 AM
272 Posts
Re: How to get the error line by try...catch... in SSJS?
Yes, especially for this forum! It would be nice if there would be an error handling implemented.
Don't search for words like "and"...
 
Sven
 
http://blog.hasselba.ch
Aug 2, 2012, 7:08 AM
26 Posts
Re: How to get the error line by try...catch... in SSJS?
 
Use the below code in a computed field on a separate Custom Control which will print the Stacktrace.
Please note that you need point your application to show this page if an error occurs.
<xp:text escape="true" id="computedField">
<xp:this.value>
<![CDATA[#{javascript:var stackTrace ="";
var trace = requestScope.error.getStackTrace() ;

for( var i = 0; i < trace.length; i++){
stackTrace += trace[i] + '\n';
}

return stackTrace;
}]]>
</xp:this.value>
</xp:text>
 Check the link below which has detailed information about error handling in xpages:
 
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal