DRY up HTTP request/error handling