mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
community: Provide more actionable errors in the MathPix PDF loader (#15630)
- **Description:** The `error_info['id']` can be cross-referenced with the MathPix API documentation to get very specific information about why an error occurred.
This commit is contained in:
parent
f0128dbcde
commit
d2a686b165
@ -462,9 +462,15 @@ class MathpixPDFLoader(BasePDFLoader):
|
||||
|
||||
# This indicates an error with the request (e.g. auth problems)
|
||||
error = response_data.get("error", None)
|
||||
error_info = response_data.get("error_info", None)
|
||||
|
||||
if error is not None:
|
||||
raise ValueError(f"Unable to retrieve PDF from Mathpix: {error}")
|
||||
error_msg = f"Unable to retrieve PDF from Mathpix: {error}"
|
||||
|
||||
if error_info is not None:
|
||||
error_msg += f" ({error_info['id']})"
|
||||
|
||||
raise ValueError(error_msg)
|
||||
|
||||
status = response_data.get("status", None)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user