Added logging of error message.