mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-04 22:36:24 -06:00
15353 add better script error message (#15441)
* 15353 add better script error message * Simplify _get_script_class() & add docstring --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -96,6 +96,7 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
|
||||
Proxy model for script module files.
|
||||
"""
|
||||
objects = ScriptModuleManager()
|
||||
error = None
|
||||
|
||||
event_rules = GenericRelation(
|
||||
to='extras.EventRule',
|
||||
@@ -126,6 +127,7 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
|
||||
try:
|
||||
module = self.get_module()
|
||||
except Exception as e:
|
||||
self.error = e
|
||||
logger.debug(f"Failed to load script: {self.python_name} error: {e}")
|
||||
module = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user