From 2af4ba861c6871fe6a9a87038ef44d275c56480d Mon Sep 17 00:00:00 2001 From: Adam Fourney Date: Fri, 28 Feb 2025 08:55:34 -0800 Subject: [PATCH] Renamed exception. --- packages/markitdown/src/markitdown/__init__.py | 4 ++-- packages/markitdown/src/markitdown/_exceptions.py | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/markitdown/src/markitdown/__init__.py b/packages/markitdown/src/markitdown/__init__.py index 59d9750..f82f024 100644 --- a/packages/markitdown/src/markitdown/__init__.py +++ b/packages/markitdown/src/markitdown/__init__.py @@ -6,7 +6,7 @@ from .__about__ import __version__ from ._markitdown import MarkItDown from ._exceptions import ( MarkItDownException, - ConverterPrerequisiteException, + MissingOptionalDependencyException, FileConversionException, UnsupportedFormatException, ) @@ -18,7 +18,7 @@ __all__ = [ "DocumentConverter", "DocumentConverterResult", "MarkItDownException", - "ConverterPrerequisiteException", + "MissingOptionalDependencyException", "FileConversionException", "UnsupportedFormatException", ] diff --git a/packages/markitdown/src/markitdown/_exceptions.py b/packages/markitdown/src/markitdown/_exceptions.py index 30c4dc5..10b8cec 100644 --- a/packages/markitdown/src/markitdown/_exceptions.py +++ b/packages/markitdown/src/markitdown/_exceptions.py @@ -6,15 +6,16 @@ class MarkItDownException(BaseException): pass -class ConverterPrerequisiteException(MarkItDownException): +class MissingOptionalDependencyException(MarkItDownException): """ - Thrown when instantiating a DocumentConverter in cases where - a required library or dependency is not installed, an API key - is not set, or some other prerequisite is not met. + Converters shipped with MarkItDown may depend on optional + dependencies. This exception is thrown when a converter's + convert() method is called, but the required dependency is not + installed. This is not necessarily a fatal error, as the converter + will simply be skipped (an error will bubble up only if no other + suitable converter is found). - This is not necessarily a fatal error. If thrown during - MarkItDown's plugin loading phase, the converter will simply be - skipped, and a warning will be issued. + Error messages should clearly indicate which dependency is missing. """ pass