A helper to produce better errors with http status codes