Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-05-17 13:12:56 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-05-17 13:12:56 +0300
commit3c7d35d2a20cfa7c915538704680a33db87c0563 (patch)
tree5c8e1c9e894f90bf18d77c324ab7829fe0c784a6 /sphinx/events.py
parent4ad466c7a602ca3b60a9cee15a07f84903a28fe8 (diff)
parent5f51a1e63f9442439466b7acede87ad21d49bdc0 (diff)
Merge branch '3.x'
Diffstat (limited to 'sphinx/events.py')
-rw-r--r--sphinx/events.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/sphinx/events.py b/sphinx/events.py
index 4673fddd8..fae870b4b 100644
--- a/sphinx/events.py
+++ b/sphinx/events.py
@@ -15,7 +15,7 @@ from operator import attrgetter
from typing import Any, Callable, Dict, List, NamedTuple
from typing import TYPE_CHECKING
-from sphinx.errors import ExtensionError
+from sphinx.errors import ExtensionError, SphinxError
from sphinx.locale import __
from sphinx.util import logging
@@ -95,7 +95,13 @@ class EventManager:
results = []
listeners = sorted(self.listeners[name], key=attrgetter("priority"))
for listener in listeners:
- results.append(listener.handler(self.app, *args))
+ try:
+ results.append(listener.handler(self.app, *args))
+ except SphinxError:
+ raise
+ except Exception as exc:
+ raise ExtensionError(__("Handler %r for event %r threw an exception") %
+ (listener.handler, name)) from exc
return results
def emit_firstresult(self, name: str, *args: Any) -> Any: