When you fill your stack ?
Stack has a size (can be enlarged if necessary), and when a program fills the stack the error is generated.
Normally this happen with recursive call (a function that call itself a never stopped to do this).
I think (sure in the old times, now I don't know) the stack overflow is an hardware error (I mean generated by CPU) and cannot be recovered.