-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #82 - Done more work making errors more type-specific to aid fu…
…ture APIs providing tailored error messages to users.
- Loading branch information
Rob Barry
committed
Aug 6, 2021
1 parent
6ad3650
commit e21b666
Showing
9 changed files
with
99 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from dataclasses import dataclass | ||
|
||
from csvqb.models.validationerror import SpecificValidationError | ||
|
||
|
||
@dataclass | ||
class DuplicateColumnTitleError(SpecificValidationError): | ||
""" | ||
An error to inform the user that they have defined two instances of the same column. | ||
""" | ||
|
||
csv_column_title: str | ||
|
||
def __post_init__(self): | ||
self.message = f"Duplicate column title '{self.csv_column_title}'" | ||
|
||
|
||
@dataclass | ||
class ColumnNotFoundInDataError(SpecificValidationError): | ||
""" | ||
An error to inform the user that they have defined a column which cannot be found in the provided data. | ||
""" | ||
|
||
csv_column_title: str | ||
|
||
def __post_init__(self): | ||
self.message = f"Column '{self.csv_column_title}' not found in data provided." | ||
|
||
|
||
@dataclass | ||
class MissingColumnDefinitionError(SpecificValidationError): | ||
""" | ||
An error to inform the user that there is a column in their data that does not have a mapping specified. | ||
""" | ||
|
||
csv_column_title: str | ||
|
||
def __post_init__(self): | ||
self.message = ( | ||
f"Column '{self.csv_column_title}' does not have a mapping defined." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters