File: exceptions.py

package info (click to toggle)
python-aniso8601 10.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 544 kB
  • sloc: python: 7,776; makefile: 3
file content (51 lines) | stat: -rw-r--r-- 1,313 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-

# Copyright (c) 2025, Brandon Nielsen
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license.  See the LICENSE file for details.


class ISOFormatError(ValueError):
    """Raised when ISO 8601 string fails a format check."""


class RangeCheckError(ValueError):
    """Parent type of range check errors."""


class YearOutOfBoundsError(RangeCheckError):
    """Raised when year exceeds limits."""


class MonthOutOfBoundsError(RangeCheckError):
    """Raised when month is outside of 1..12."""


class WeekOutOfBoundsError(RangeCheckError):
    """Raised when week exceeds a year."""


class DayOutOfBoundsError(RangeCheckError):
    """Raised when day is outside of 1..365, 1..366 for leap year."""


class HoursOutOfBoundsError(RangeCheckError):
    """Raise when parsed hours are greater than 24."""


class MinutesOutOfBoundsError(RangeCheckError):
    """Raise when parsed seconds are greater than 60."""


class SecondsOutOfBoundsError(RangeCheckError):
    """Raise when parsed seconds are greater than 60."""


class MidnightBoundsError(RangeCheckError):
    """Raise when parsed time has an hour of 24 but is not midnight."""


class LeapSecondError(RangeCheckError):
    """Raised when attempting to parse a leap second"""