How to convert a stack trace to a string?

How to convert a stack trace to a string?

More to explore

Based on this image's title: “How to convert a stack trace to a string?