errors.py 816 B

12345678910111213141516171819202122
  1. # Ultralytics YOLO 🚀, AGPL-3.0 license
  2. from ultralytics.utils import emojis
  3. class HUBModelError(Exception):
  4. """
  5. Custom exception class for handling errors related to model fetching in Ultralytics YOLO.
  6. This exception is raised when a requested model is not found or cannot be retrieved.
  7. The message is also processed to include emojis for better user experience.
  8. Attributes:
  9. message (str): The error message displayed when the exception is raised.
  10. Note:
  11. The message is automatically processed through the 'emojis' function from the 'ultralytics.utils' package.
  12. """
  13. def __init__(self, message="Model not found. Please check model URL and try again."):
  14. """Create an exception for when a model is not found."""
  15. super().__init__(emojis(message))