fixed logging for error cases. Tested with invalid domain, invalid URL, and a few other cases