Factored out HTTP error + log