mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
implemented exception for missing keys
This commit is contained in:
parent
3a53f8a944
commit
93f489d0c3
1 changed files with 20 additions and 0 deletions
|
|
@ -215,6 +215,26 @@ def _fill_inner_schemas(schema_data, schema_collection):
|
|||
return schema_data
|
||||
|
||||
|
||||
class SchemaTemplateMissingKeys(Exception):
|
||||
def __init__(self, missing_keys, required_keys, template_name=None):
|
||||
self.missing_keys = missing_keys
|
||||
self.required_keys = required_keys
|
||||
if template_name:
|
||||
msg = f"Schema template \"{template_name}\" require more keys.\n"
|
||||
else:
|
||||
msg = ""
|
||||
msg += "Required keys: {}\nMissing keys: {}".format(
|
||||
self.join_keys(required_keys),
|
||||
self.join_keys(missing_keys)
|
||||
)
|
||||
super(SchemaTemplateMissingKeys, self).__init__(msg)
|
||||
|
||||
def join_keys(self, keys):
|
||||
return ", ".join([
|
||||
f"\"{key}\"" for key in keys
|
||||
])
|
||||
|
||||
|
||||
class SchemaMissingFileInfo(Exception):
|
||||
def __init__(self, invalid):
|
||||
full_path_keys = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue