Capture stacktraces for errors.