mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 21:33:41 -05:00
better error traceback
This commit is contained in:
parent
791530b28a
commit
8aebe83d4d
1 changed files with 5 additions and 1 deletions
|
@ -8,6 +8,7 @@ from mistune import HTMLRenderer, escape
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from psycopg.rows import dict_row
|
from psycopg.rows import dict_row
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
|
import traceback
|
||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
import zipfile
|
import zipfile
|
||||||
|
@ -76,7 +77,7 @@ def appendToJSON(new_data, file_path) -> bool:
|
||||||
json.dump(file_data, file, indent=4)
|
json.dump(file_data, file, indent=4)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
app.logger.error(str(e))
|
app.logger.error(f"[appendToJSON] {str(e)}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
cfg = loadJSON(const.configFile)
|
cfg = loadJSON(const.configFile)
|
||||||
|
@ -276,6 +277,7 @@ def getAnswer(question_id: int) -> dict:
|
||||||
answer['creation_date'] = answer['creation_date'].replace(microsecond=0).replace(tzinfo=None)
|
answer['creation_date'] = answer['creation_date'].replace(microsecond=0).replace(tzinfo=None)
|
||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
def addAnswer(question_id: int, answer: str, cw: str) -> dict:
|
def addAnswer(question_id: int, answer: str, cw: str) -> dict:
|
||||||
|
@ -743,8 +745,10 @@ def createExport() -> dict:
|
||||||
|
|
||||||
return {'message': _('Export created successfully!')}
|
return {'message': _('Export created successfully!')}
|
||||||
except psycopg.Error as e:
|
except psycopg.Error as e:
|
||||||
|
app.logger.error(f"[psycopg.Error] {traceback.format_exc()}")
|
||||||
return {'error': str(e)}, 500
|
return {'error': str(e)}, 500
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
app.logger.error(f"[Exception] {traceback.format_exc()}")
|
||||||
return {'error': str(e)}, 500
|
return {'error': str(e)}, 500
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue