Commit af65fed3 authored by Administrator's avatar Administrator

[FEAT] To all developers, please use this function PrintException().

parent 956ddde4
import os
import os, sys
import linecache
from gargantext_web.settings import MEDIA_ROOT
def ensure_dir(user):
......@@ -9,3 +11,12 @@ def ensure_dir(user):
os.makedirs(dirpath)
def PrintException():
exc_type, exc_obj, tb = sys.exc_info()
f = tb.tb_frame
lineno = tb.tb_lineno
filename = f.f_code.co_filename
linecache.checkcache(filename)
line = linecache.getline(filename, lineno, f.f_globals)
print('EXCEPTION IN ({}, LINE {} "{}"): {}'.format(filename, lineno, line.strip(), exc_obj))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment