diff options
Diffstat (limited to 'sphinx/errors.py')
-rw-r--r-- | sphinx/errors.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sphinx/errors.py b/sphinx/errors.py index c632d8dbc..3e84b6b88 100644 --- a/sphinx/errors.py +++ b/sphinx/errors.py @@ -47,12 +47,19 @@ class ApplicationError(SphinxError): class ExtensionError(SphinxError): """Extension error.""" - category = 'Extension error' - def __init__(self, message: str, orig_exc: Exception = None) -> None: + def __init__(self, message: str, orig_exc: Exception = None, modname: str = None) -> None: super().__init__(message) self.message = message self.orig_exc = orig_exc + self.modname = modname + + @property + def category(self) -> str: # type: ignore + if self.modname: + return 'Extension error (%s)' % self.modname + else: + return 'Extension error' def __repr__(self) -> str: if self.orig_exc: |