1. Georg Brandl
  2. sphinx-contrib
  3. Issues
Issue #45 resolved

httpdomain: http_statuscode_role should except on ValueError not Value

ViktorHaag
created an issue

Inside the else associated with 'if text.isdigit()' you attempt to catch Value... I suspect this needs to be ValueError? Characterized as major because it halts execution with an exception if the try block throws a ValueError; work around is not to have a bad :http:statuscode:{val} value.

if text.isdigit():
...
else:
        try:
            code, status = re.split(r'\s', text.strip(), 1)
            code = int(code)
        except Value:
            msg = inliner.reporter.error(
                'HTTP status code must be an integer (e.g. `200`) or '
                'start with an integer (e.g. `200 OK`); %r is invalid' %
                text,
                line=lineno
            )
            prb = inliner.problematic(rawtext, rawtext, msg)
            return [prb], [msg]

Comments (3)

  1. Log in to comment