added exception handling

mainly for the urllib2.HTTPError that I sometimes get when running for a long time