Show More
@@ -14,11 +14,10 b' import os' | |||
|
14 | 14 | from .common import ( |
|
15 | 15 | ErrorResponse, |
|
16 | 16 | HTTP_BAD_REQUEST, |
|
17 | HTTP_NOT_FOUND, | |
|
18 | 17 | HTTP_OK, |
|
19 | HTTP_SERVER_ERROR, | |
|
20 | 18 | cspvalues, |
|
21 | 19 | permhooks, |
|
20 | statusmessage, | |
|
22 | 21 | ) |
|
23 | 22 | |
|
24 | 23 | from .. import ( |
@@ -417,18 +416,25 b' class hgweb(object):' | |||
|
417 | 416 | return content |
|
418 | 417 | |
|
419 | 418 | except (error.LookupError, error.RepoLookupError) as err: |
|
420 | wsgireq.respond(HTTP_NOT_FOUND, ctype) | |
|
421 | 419 | msg = pycompat.bytestr(err) |
|
422 | 420 | if (util.safehasattr(err, 'name') and |
|
423 | 421 | not isinstance(err, error.ManifestLookupError)): |
|
424 | 422 | msg = 'revision not found: %s' % err.name |
|
425 | return tmpl('error', error=msg) | |
|
426 | except (error.RepoError, error.RevlogError) as inst: | |
|
427 | wsgireq.respond(HTTP_SERVER_ERROR, ctype) | |
|
428 |
re |
|
|
429 | except ErrorResponse as inst: | |
|
430 | wsgireq.respond(inst, ctype) | |
|
431 | return tmpl('error', error=pycompat.bytestr(inst)) | |
|
423 | ||
|
424 | res.status = '404 Not Found' | |
|
425 | res.headers['Content-Type'] = ctype | |
|
426 | res.setbodygen(tmpl('error', error=msg)) | |
|
427 | return res.sendresponse() | |
|
428 | except (error.RepoError, error.RevlogError) as e: | |
|
429 | res.status = '500 Internal Server Error' | |
|
430 | res.headers['Content-Type'] = ctype | |
|
431 | res.setbodygen(tmpl('error', error=pycompat.bytestr(e))) | |
|
432 | return res.sendresponse() | |
|
433 | except ErrorResponse as e: | |
|
434 | res.status = statusmessage(e.code, pycompat.bytestr(e)) | |
|
435 | res.headers['Content-Type'] = ctype | |
|
436 | res.setbodygen(tmpl('error', error=pycompat.bytestr(e))) | |
|
437 | return res.sendresponse() | |
|
432 | 438 | |
|
433 | 439 | def check_perm(self, rctx, req, op): |
|
434 | 440 | for permhook in permhooks: |
General Comments 0
You need to be logged in to leave comments.
Login now