mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Include stack trace when catching an exception
This commit is contained in:
parent
8bd1fad7d0
commit
434e656e27
@ -3,7 +3,9 @@ import inspect
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pkgutil
|
import pkgutil
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
@ -265,8 +267,9 @@ def run_script(script, data, commit=True):
|
|||||||
except AbortTransaction:
|
except AbortTransaction:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
stacktrace = traceback.format_exc()
|
||||||
script.log_failure(
|
script.log_failure(
|
||||||
"An exception occurred. {}: {}".format(type(e).__name__, e)
|
"An exception occurred. {}: {}\n```{}```".format(type(e).__name__, e, stacktrace)
|
||||||
)
|
)
|
||||||
commit = False
|
commit = False
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user