Added error logging for exceptions

Sure, but I can be done better :-)