aboutsummaryrefslogtreecommitdiff
path: root/quality_control/errors.py
blob: 1eda646f7cb1cf4a4ebe9f48bc6774d16e0c3185 (plain)
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
"""Hold exceptions for QC package"""

from collections import namedtuple

class InvalidCellValue(Exception):
    """Raised when a function encounters an invalid value"""

    def __init__(self, *args):
        super().__init__(*args)

class InvalidHeaderValue(Exception):
    """Raised when a header contains values not in the reference file."""

    def __init__(self, *args):
        super().__init__(*args)

class DuplicateHeader(Exception):
    """Raised when a header contains 2 similar headers."""

    def __init__(self, *args):
        super().__init__(*args)

class ParseError(Exception):
    """Raised if any of the above exceptions are raised"""
    def __init__(self, *args):
        super().__init__(*args)

InvalidValue = namedtuple(
    "InvalidValue", ("line_number", "column_number", "value", "message"))

DuplicateHeading = namedtuple(
    "InvalidValue", ("line_number", "heading", "columns","message"))