What is Stack Begin and Stack End

Sometimes when looking at the output I would see these Stack Begin and Stack End wrapping a line in the script with letters having the color blue. I want to know what it means and what they do. Are they good, bad or just don’t pay attention to them. Here is an example.
image
Any help is appreciated!

2 Likes

The stack trace basically traces back what functions called what in the events that lead to the error, it’s useful for debugging to see what function caused the error.

Here, “Stack End” and “Stack Begin” just indicate the callstack. Nothing more.

5 Likes

The above reply is great, and I wanted to add a little more context. The reason it’s called a “stack” is because there is a data structure known as a stack. It holds data in the order given to it. A stack is basically “LIFO”, Last In First Out, for information.

Imagine stacking plates on top of one another. The last plate you put there on top is the first plate you will use.

So, if I give the stack A, B, C in that order, I will get back C, B, A. (I say “get back” for simplicity, but generally speaking, you can only read and remove the top element of the stack, and add new data as the top element of the stack. Some may say you can traverse the stack in LIFO order, but I don’t really want to get into that here as it’s out of scope for a general introduction to stacks.)

The “call stack” is essentially the stack of functions called. So, if I call function A, which calls function B, which calls function C, and then an error occurs in function C, I’ll get back: function C, function B, function A! That way, you know exactly where to find your error and how your scripts arrived at that place.

5 Likes
2 Likes