Adding some error checking to the web client code