INNER CODE UNIT · Python
handle_error
cognitivetech/ollama-ebook-summary · sum.py:53
def handle_error(message: str, details: Dict[str, Any] = None, exit: bool = True):
"""
Handle errors by printing a detailed message and optionally exiting.
Args:
message: Main error message
details: Dictionary containing additional error details
exit: Whether to exit the program
"""
print("\n=== ERROR DETAILS ===")
print(f"Error: {message}")
if details:
print("\n--- Additional Details ---")
for key, value in details.items():
print(f"{key}: {value}")
print("=====================\n")