handle HTTP errors

latest commit e0c2ce8f25
@WnP authored