daemon: Include stack trace information when an exception occurs in a

session state hook.
This commit is contained in:
Tom Goff 2015-11-04 19:06:33 -05:00
parent fc9a7c5759
commit c8d5ec994a

View file

@ -13,6 +13,7 @@ that manages a CORE session.
import os, sys, tempfile, shutil, shlex, atexit, gc, pwd import os, sys, tempfile, shutil, shlex, atexit, gc, pwd
import threading, time, random import threading, time, random
import traceback
from core.api import coreapi from core.api import coreapi
if os.uname()[0] == "Linux": if os.uname()[0] == "Linux":
@ -331,8 +332,9 @@ class Session(object):
hook(state) hook(state)
except Exception, e: except Exception, e:
self.warn("ERROR: exception occured when running %s state " self.warn("ERROR: exception occured when running %s state "
"hook: %s: %s" % (coreapi.state_name(state), "hook: %s: %s\n%s" % (coreapi.state_name(state),
hook, e)) hook, e,
traceback.format_exc()))
def add_state_hook(self, state, hook): def add_state_hook(self, state, hook):
try: try: