Trim stack trace.

This is just some ideas I had for fixing #669. I haven't written tests yet; just wanted early feedback.

Is this method used somewhere?