##// END OF EJS Templates
httppeer: use try/except/finally
Matt Mackall -
r25085:e05734cd default
parent child Browse files
Show More
@@ -198,16 +198,15 b' class httppeer(wireproto.wirepeer):'
198 headers = {'Content-Type': 'application/mercurial-0.1'}
198 headers = {'Content-Type': 'application/mercurial-0.1'}
199
199
200 try:
200 try:
201 try:
201 r = self._call(cmd, data=fp, headers=headers, **args)
202 r = self._call(cmd, data=fp, headers=headers, **args)
202 vals = r.split('\n', 1)
203 vals = r.split('\n', 1)
203 if len(vals) < 2:
204 if len(vals) < 2:
204 raise error.ResponseError(_("unexpected response:"), r)
205 raise error.ResponseError(_("unexpected response:"), r)
205 return vals
206 return vals
206 except socket.error, err:
207 except socket.error, err:
207 if err.args[0] in (errno.ECONNRESET, errno.EPIPE):
208 if err.args[0] in (errno.ECONNRESET, errno.EPIPE):
208 raise util.Abort(_('push failed: %s') % err.args[1])
209 raise util.Abort(_('push failed: %s') % err.args[1])
209 raise util.Abort(err.args[1])
210 raise util.Abort(err.args[1])
211 finally:
210 finally:
212 fp.close()
211 fp.close()
213 os.unlink(tempname)
212 os.unlink(tempname)
General Comments 0
You need to be logged in to leave comments. Login now