return stack trace as a string instead of printing it