Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgweb_mod.py @ 7740:176d3d681702
hgweb: pass ErrorResponses directly into req.respond()
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 09 Feb 2009 11:29:09 +0100 |
parents | 1d54e2f6c0b7 |
children | b5ed0ab8cc74 |
comparison
equal
deleted
inserted
replaced
7739:edcb56991afe | 7740:176d3d681702 |
---|---|
97 req.drain() | 97 req.drain() |
98 raise | 98 raise |
99 method = getattr(protocol, cmd) | 99 method = getattr(protocol, cmd) |
100 return method(self.repo, req) | 100 return method(self.repo, req) |
101 except ErrorResponse, inst: | 101 except ErrorResponse, inst: |
102 req.respond(inst.code, protocol.HGTYPE) | 102 req.respond(inst, protocol.HGTYPE) |
103 if not inst.message: | 103 if not inst.message: |
104 return [] | 104 return [] |
105 return '0\n%s\n' % inst.message, | 105 return '0\n%s\n' % inst.message, |
106 | 106 |
107 # work with CGI variables to create coherent structure | 107 # work with CGI variables to create coherent structure |
192 return tmpl('error', error=msg) | 192 return tmpl('error', error=msg) |
193 except (error.RepoError, error.RevlogError), inst: | 193 except (error.RepoError, error.RevlogError), inst: |
194 req.respond(HTTP_SERVER_ERROR, ctype) | 194 req.respond(HTTP_SERVER_ERROR, ctype) |
195 return tmpl('error', error=str(inst)) | 195 return tmpl('error', error=str(inst)) |
196 except ErrorResponse, inst: | 196 except ErrorResponse, inst: |
197 req.respond(inst.code, ctype) | 197 req.respond(inst, ctype) |
198 return tmpl('error', error=inst.message) | 198 return tmpl('error', error=inst.message) |
199 | 199 |
200 def templater(self, req): | 200 def templater(self, req): |
201 | 201 |
202 # determine scheme, port and server name | 202 # determine scheme, port and server name |