Include stack trace when catching an exception

This commit is contained in:
Jeremy Stretch 2019-08-14 14:26:13 -04:00
parent f0ec068650
commit 502e745509

View File

@ -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: