diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-05 01:28:15 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-05 01:28:15 +0900 |
| commit | b268963709dc9256cf711d4cc054a86e70226702 (patch) | |
| tree | d45c1f1954b677f8d21c8dab1593ef7be4e6e037 /sphinx/directives/code.py | |
| parent | eb07b070e468025c91c8c4adc615effcb62f8057 (diff) | |
| parent | 05c65163ecd0ce7bdb7c6807de683266b98e5b28 (diff) | |
| download | sphinx-git-b268963709dc9256cf711d4cc054a86e70226702.tar.gz | |
Merge commit '05c65163ecd0ce7bdb7c6807de683266b98e5b28'
Diffstat (limited to 'sphinx/directives/code.py')
| -rw-r--r-- | sphinx/directives/code.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index fabf259e8..b79950ea4 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -215,12 +215,13 @@ class LiteralIncludeReader: text = text.expandtabs(self.options['tab-width']) return text.splitlines(True) - except OSError: - raise OSError(__('Include file %r not found or reading it failed') % filename) - except UnicodeError: + except OSError as exc: + raise OSError(__('Include file %r not found or reading it failed') % + filename) from exc + except UnicodeError as exc: raise UnicodeError(__('Encoding %r used for reading included file %r seems to ' 'be wrong, try giving an :encoding: option') % - (self.encoding, filename)) + (self.encoding, filename)) from exc def read(self, location: Tuple[str, int] = None) -> Tuple[str, int]: if 'diff' in self.options: |
