Skip global scripts that cannot be 'imported' successfully, and log_err about it.
This commit is contained in:
parent
c06be8df48
commit
796f3910c6
1 changed files with 6 additions and 3 deletions
|
|
@ -202,14 +202,17 @@ class GlobalScriptContainer(Container):
|
||||||
"""
|
"""
|
||||||
if self.typeclass_storage is None:
|
if self.typeclass_storage is None:
|
||||||
self.typeclass_storage = {}
|
self.typeclass_storage = {}
|
||||||
for key, data in self.loaded_data.items():
|
for key, data in list(self.loaded_data.items()):
|
||||||
try:
|
try:
|
||||||
typeclass = data.get("typeclass", settings.BASE_SCRIPT_TYPECLASS)
|
typeclass = data.get("typeclass", settings.BASE_SCRIPT_TYPECLASS)
|
||||||
self.typeclass_storage[key] = class_from_module(typeclass)
|
self.typeclass_storage[key] = class_from_module(typeclass)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log_trace(
|
logger.log_err(
|
||||||
f"GlobalScriptContainer could not start import global script {key}."
|
f"GlobalScriptContainer could not start import global script {key}. "
|
||||||
|
"It will be removed (skipped)."
|
||||||
)
|
)
|
||||||
|
# Let's remove this key/value. We want to let other scripts load.
|
||||||
|
self.loaded_data.pop(key)
|
||||||
|
|
||||||
def get(self, key, default=None):
|
def get(self, key, default=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue