Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc raise exceptions with a base class #18152

Merged
merged 2 commits into from Oct 6, 2017
Merged

Conversation

alfredodeza
Copy link
Contributor

@alfredodeza alfredodeza commented Oct 6, 2017

Although valid in very old Python, it is no longer possible to raise
"bare" exceptions without a class.

Fixes the following build errors:

+ ./admin/build-doc
Traceback (most recent call last):
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/gen_state_diagram.py", line 207, in <module>
    RENDERER.read_input(INPUT_GENERATOR)
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/gen_state_diagram.py", line 89, in read_input
    self.get_event(line)
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/gen_state_diagram.py", line 141, in get_event
    raise "no context at line: " + line
TypeError: exceptions must be old-style classes or derived from BaseException, not str

Although valid in very old Python, it is no longer possible to raise
"bare" exceptions without a class.

Signed-off-by: Alfredo Deza <adeza@redhat.com>
Copy link
Member

@theanalyst theanalyst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good for merge once the doc build passes

@theanalyst
Copy link
Member

now the exception is raised properly and the program fails gracefully, but we need to find out what caused that..

@theanalyst
Copy link
Member

seems to have been introduced in #18070, not sure whether the state diagrams need to be a part of docs build, are these a part of hte doc output?

@@ -107,7 +107,7 @@ def get_state(self, line):
r"boost::statechart::state_machine<\s*(\w*),\s*(\w*)\s*>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing L93 to match = re.search(r"(\w+::)*::(?P<tag>\w+)::\w+\(\s*const (?P<event>\w+)", makes the script pass locally for me

So that signatures can get parsed when they are split like:

PG::RecoveryState::RepWaitBackfillReserved::react(
  const RemoteReservationCanceled &evt)

Signed-off-by: Alfredo Deza <adeza@redhat.com>
@theanalyst theanalyst merged commit d71a42c into master Oct 6, 2017
@alfredodeza alfredodeza deleted the wip-fix-doc-exceptions branch October 6, 2017 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants