Add more details to error message
This commit is contained in:
parent
5d0f7b88b5
commit
dfc0a01e9f
Binary file not shown.
|
|
@ -1,3 +1,4 @@
|
|||
import traceback
|
||||
from typing import Callable
|
||||
|
||||
from django.contrib import messages
|
||||
|
|
@ -52,7 +53,12 @@ def handle_import(request, success_msg: str, importer: Callable[[str], None]):
|
|||
try:
|
||||
importer(excel_file)
|
||||
except Exception as e:
|
||||
return render(request, "admin/importer/error.html", {"error": str(e)})
|
||||
return render(
|
||||
# it is a "power" feature, so we will output the traceback on error
|
||||
request,
|
||||
"admin/importer/error.html",
|
||||
{"error": traceback.format_exc()},
|
||||
)
|
||||
|
||||
messages.info(request, success_msg)
|
||||
return redirect("admin:index")
|
||||
|
|
|
|||
Loading…
Reference in New Issue