cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Get the call stack of the javascript service

seanccc
17-Peridot

Get the call stack of the javascript service

Hi,

 

I want to all of the service use a unified way of raise error message ,  so the the service will call the wrapped service like RaiseError service instead of javascript statement "throw new error" when raising error.   

The problem is that you can only find the line number of RaiseError service in the application log for any service while I need the original position where RaiseError is called .   

So can I get the call stack with information of line number so that I can log a more specified error info ? 

 

Regards,

Sean

1 ACCEPTED SOLUTION

Accepted Solutions

@seanccc ,

 

The JavaScript Error object has lineNumber and stack that you can access in your catch statement:

 

try{
  //some code here
}
catch(err) {
   logger.warn(err.lineNumber + " " + err.stack);
}

 

 

View solution in original post

1 REPLY 1

@seanccc ,

 

The JavaScript Error object has lineNumber and stack that you can access in your catch statement:

 

try{
  //some code here
}
catch(err) {
   logger.warn(err.lineNumber + " " + err.stack);
}

 

 

Announcements