view tests/hgweberror.py @ 23641:a7a0f32a383f

merge: make calculateupdates() return file->action dict This simplifies largefiles' overridecalculateupdates(), which no longer has to do the conversion it started doing in 38e55e55ae4d (largefiles: rewrite merge code using dictionary with entry per file, 2014-12-09). To keep this patch small, we'll leave the name 'actionbyfile' in overrides.py. It will be renamed in the next patch.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 11 Dec 2014 22:07:41 -0800
parents dc4d2cd3aa3e
children 74e6de99ce7f
line wrap: on
line source

# A dummy extension that installs an hgweb command that throws an Exception.

from mercurial.hgweb import webcommands

def raiseerror(web, req, tmpl):
    '''Dummy web command that raises an uncaught Exception.'''

    # Simulate an error after partial response.
    if 'partialresponse' in req.form:
        req.respond(200, 'text/plain')
        req.write('partial content\n')

    raise AttributeError('I am an uncaught error!')

def extsetup(ui):
    setattr(webcommands, 'raiseerror', raiseerror)
    webcommands.__all__.append('raiseerror')