mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix exception causes in code.py
This commit is contained in:
parent
9df73e65b8
commit
5ad6f37757
@ -227,12 +227,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:
|
||||
|
Loading…
Reference in New Issue
Block a user