Better http error handling