Print stack on error events

Error stacks are never written to file. Need to get the stack/message from the error object before writing to file.

Feedback is appreciated!