handle http errors

ok @jrick, @jcvernaleo