-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from COVESA/better_logs
logging format is improved
- Loading branch information
Showing
4 changed files
with
42 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
from typing import Dict, List | ||
|
||
from deepdiff import DeepDiff | ||
import json | ||
|
||
class IDConflictException(Exception): | ||
def __init__(self, instances: List[Dict]): | ||
err_msg = f"More than 2 instances with same ID ! \n{instances}\n" | ||
err_msg = f"More than 2 instances with same ID ! \n{json.dumps(instances,indent=2)}\n" | ||
super().__init__(err_msg) | ||
self.message = err_msg | ||
|
||
|
||
class BaseInstanceOverwiteException(Exception): | ||
def __init__(self, base_instance, extended_instance): | ||
def __init__(self, base_instance: dict, extended_instance: dict): | ||
diff = DeepDiff(base_instance, extended_instance, ignore_order=True) | ||
err_msg = ( | ||
f"The extended instance :\n{extended_instance}\nis overwriting properties of base instance\n{base_instance}\n" | ||
f"Issue with {base_instance['id']}\nThe extended instance is overwriting properties of base instance:\n{diff.pretty()}\n" | ||
) | ||
super().__init__(err_msg) | ||
self.message = err_msg | ||
|
||
|
||
class InvalidReferentIDException(Exception): | ||
def __init__(self, instance, referentID): | ||
err_msg = f"The instance :\n{instance}\nis referencing an invalid id : '{referentID}'\n" | ||
def __init__(self, instance : dict, referentID): | ||
err_msg = f"The instance :\n{json.dumps(instance,indent=2)}\nis referencing an invalid id : '{referentID}'\n" | ||
super().__init__(err_msg) | ||
self.message = err_msg |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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