-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error handling for loading configs, roll back to previous versions if a version is invalid. Report errors back to integrations if a CDF-hosted application config fails to load. Improve error handling overall, with better error messages relayed to the end user. Do a connection check at startup to make sure the connection config is valid, with good error messages.
- Loading branch information
Showing
10 changed files
with
280 additions
and
75 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
24 changes: 24 additions & 0 deletions
24
cognite/extractorutils/unstable/configuration/exceptions.py
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,24 @@ | ||
from typing import List, Optional | ||
|
||
|
||
class InvalidConfigError(Exception): | ||
""" | ||
Exception thrown from ``load_yaml`` and ``load_yaml_dict`` if config file is invalid. This can be due to | ||
* Missing fields | ||
* Incompatible types | ||
* Unkown fields | ||
""" | ||
|
||
def __init__(self, message: str, details: Optional[List[str]] = None): | ||
super(InvalidConfigError, self).__init__() | ||
self.message = message | ||
self.details = details | ||
|
||
self.attempted_revision: int | None = None | ||
|
||
def __str__(self) -> str: | ||
return f"Invalid config: {self.message}" | ||
|
||
def __repr__(self) -> str: | ||
return self.__str__() |
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
Oops, something went wrong.