441 |
441 |
442 return content |
442 return content |
443 |
443 |
444 except (error.LookupError, error.RepoLookupError) as err: |
444 except (error.LookupError, error.RepoLookupError) as err: |
445 req.respond(HTTP_NOT_FOUND, ctype) |
445 req.respond(HTTP_NOT_FOUND, ctype) |
446 msg = str(err) |
446 msg = pycompat.bytestr(err) |
447 if (util.safehasattr(err, 'name') and |
447 if (util.safehasattr(err, 'name') and |
448 not isinstance(err, error.ManifestLookupError)): |
448 not isinstance(err, error.ManifestLookupError)): |
449 msg = 'revision not found: %s' % err.name |
449 msg = 'revision not found: %s' % err.name |
450 return tmpl('error', error=msg) |
450 return tmpl('error', error=msg) |
451 except (error.RepoError, error.RevlogError) as inst: |
451 except (error.RepoError, error.RevlogError) as inst: |
452 req.respond(HTTP_SERVER_ERROR, ctype) |
452 req.respond(HTTP_SERVER_ERROR, ctype) |
453 return tmpl('error', error=str(inst)) |
453 return tmpl('error', error=pycompat.bytestr(inst)) |
454 except ErrorResponse as inst: |
454 except ErrorResponse as inst: |
455 req.respond(inst, ctype) |
455 req.respond(inst, ctype) |
456 if inst.code == HTTP_NOT_MODIFIED: |
456 if inst.code == HTTP_NOT_MODIFIED: |
457 # Not allowed to return a body on a 304 |
457 # Not allowed to return a body on a 304 |
458 return [''] |
458 return [''] |
459 return tmpl('error', error=str(inst)) |
459 return tmpl('error', error=pycompat.bytestr(inst)) |
460 |
460 |
461 def check_perm(self, rctx, req, op): |
461 def check_perm(self, rctx, req, op): |
462 for permhook in permhooks: |
462 for permhook in permhooks: |
463 permhook(rctx, req, op) |
463 permhook(rctx, req, op) |
464 |
464 |