HTTP API: tweak error handling