AppsScriptPulse

How to Print the Function Call Flow with Stack Trace in JavaScript/Google Apps Script – Digital Inspiration

The printStackTrace method of Java is useful for handling exceptions and errors during development. It tells you the exact line number in your source code and the file name where the problem occurred.

If you are working in the JavaScript / Google Apps Script world, you can use the console.trace() method to output the complete stack inside the web console ( or StackDriver logs for Google Scripts).

A better alternative is that you parse the stack property of the Error object. This contains the entire stack trace along with line numbers, column position and the function names.

Great debugging tip from Amit that you can use in Google Apps Script for parsing the entire stack trace along with line numbers, column position and the function names. Check the source link below for example code and usage.

Source: How to Print the Function Call Flow with Stack Trace in JavaScript – Digital Inspiration

Leave a Reply

Your email address will not be published. Required fields are marked *