Source code for chart_me.errors

"""A collection of custom errors used in Chart Me

helpful url found here:
https://www.programiz.com/python-programming/user-defined-exception
reminder: default behavior accepts a message
"""


[docs]class ColumnDoesNotExistsError(Exception): """Implementation to track if column not found in pandas""" pass
[docs]class ColumnAllNullError(Exception): """Implementation of error if column is all nulls""" pass
[docs]class ColumnTooManyNullsError(Exception): """Implementation of error if columns has too many nulls""" def __init__(self, null_rate, message="Null Rate below Threshold"): """set variables""" self.null_rate = null_rate self.message = message super().__init__(self.message)
[docs] def __str__(self): """Override string representations""" return f"{self.null_rate} calculated --> {self.message}"
[docs]class InsufficientValidColumnsError(Exception): """Implementation of error if there's no valid columns to chart""" pass