Fix bug in logging when thrown error is a string