pi: add try catch in case we get http/socket errors