save traceback in case of error creating ticket (#12607)

This commit is contained in:
Frédéric Péters 2016-07-16 09:00:02 +02:00
parent 8c1f5f791a
commit 834bb8ebcf
1 changed files with 6 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import tempfile
import uuid
import smtplib
import subprocess
import traceback
import redmine
from redmine import Redmine
@ -133,5 +134,9 @@ if __name__ == '__main__':
mail_dump.write(mail)
try:
create_ticket(mail)
except:
except Exception as e:
exim = subprocess.Popen(['/usr/sbin/exim', FALLBACK_EMAIL], stdin=file(filename))
trace = traceback.format_exc()
filename = os.path.join(mail_dumps_dir, '%s.trace' % uuid.uuid4())
with open(filename, 'w') as mail_dump:
mail_dump.write(trace)