CSV Loader
This commit is contained in:
21
lib/csv_loader/errors.py
Normal file
21
lib/csv_loader/errors.py
Normal file
@ -0,0 +1,21 @@
|
||||
class CSVValidationError(Exception):
|
||||
"""Extended validation exception class containing additional attributes."""
|
||||
|
||||
def __init__(self, line_number: int, original_error: Exception) -> None:
|
||||
self.line_number = line_number
|
||||
self.original_error = original_error
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"Error at line {self.line_number}: {self.original_error}"
|
||||
|
||||
|
||||
class MappingStrategyError(Exception):
|
||||
...
|
||||
|
||||
|
||||
class HeaderNotSetError(MappingStrategyError):
|
||||
detail = "Header must be set in order to use MappingStrategyByHeader"
|
||||
|
||||
|
||||
class IndexOutOfHeaderBounds(MappingStrategyError):
|
||||
detail = "Row value index out of header bounds"
|
||||
Reference in New Issue
Block a user