exceptions.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # -*- coding: utf-8 -*-
  2. # Copyright (c) 2021, Brandon Nielsen
  3. # All rights reserved.
  4. #
  5. # This software may be modified and distributed under the terms
  6. # of the BSD license. See the LICENSE file for details.
  7. class ISOFormatError(ValueError):
  8. """Raised when ISO 8601 string fails a format check."""
  9. class RangeCheckError(ValueError):
  10. """Parent type of range check errors."""
  11. class YearOutOfBoundsError(RangeCheckError):
  12. """Raised when year exceeds limits."""
  13. class MonthOutOfBoundsError(RangeCheckError):
  14. """Raised when month is outside of 1..12."""
  15. class WeekOutOfBoundsError(RangeCheckError):
  16. """Raised when week exceeds a year."""
  17. class DayOutOfBoundsError(RangeCheckError):
  18. """Raised when day is outside of 1..365, 1..366 for leap year."""
  19. class HoursOutOfBoundsError(RangeCheckError):
  20. """Raise when parsed hours are greater than 24."""
  21. class MinutesOutOfBoundsError(RangeCheckError):
  22. """Raise when parsed seconds are greater than 60."""
  23. class SecondsOutOfBoundsError(RangeCheckError):
  24. """Raise when parsed seconds are greater than 60."""
  25. class MidnightBoundsError(RangeCheckError):
  26. """Raise when parsed time has an hour of 24 but is not midnight."""
  27. class LeapSecondError(RangeCheckError):
  28. """Raised when attempting to parse a leap second"""