tests/hgweberror.py
branchstable
changeset 23409 dc4d2cd3aa3e
child 27299 74e6de99ce7f
equal deleted inserted replaced
23403:edf29f9c15f0 23409:dc4d2cd3aa3e
       
     1 # A dummy extension that installs an hgweb command that throws an Exception.
       
     2 
       
     3 from mercurial.hgweb import webcommands
       
     4 
       
     5 def raiseerror(web, req, tmpl):
       
     6     '''Dummy web command that raises an uncaught Exception.'''
       
     7 
       
     8     # Simulate an error after partial response.
       
     9     if 'partialresponse' in req.form:
       
    10         req.respond(200, 'text/plain')
       
    11         req.write('partial content\n')
       
    12 
       
    13     raise AttributeError('I am an uncaught error!')
       
    14 
       
    15 def extsetup(ui):
       
    16     setattr(webcommands, 'raiseerror', raiseerror)
       
    17     webcommands.__all__.append('raiseerror')