log stack traces on error and keep error history

Propagate error traces when we create new exceptions.
Log stacktraces when we log exceptions.