Skip to content

Commit

Permalink
Fix silent lab rendering errors
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Nov 13, 2024
1 parent 8d9ce9f commit 734faf0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/labs/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Views for home app."""

import logging
import traceback
from django.conf import settings
from django.shortcuts import render
from django.template import (
Expand Down Expand Up @@ -41,6 +42,7 @@ def export_lab(request):
})
context.validate()
except LabBuildError as exc:
logger.warning(f"Error building lab: {traceback.format_exc()}")
return render(request, 'labs/export-error.html', {
'exc': exc,
}, status=400)
Expand All @@ -60,6 +62,10 @@ def export_lab(request):
template_str = t.render(RequestContext(request, context))
i += 1
except Exception as exc:
logger.error(
f"Error rendering template for"
f" content_root={request.GET.get('content_root')}:"
f"\n{traceback.format_exc()}")
return report_exception_response(request, exc)

response = LabCache.put(request, template_str)
Expand Down

0 comments on commit 734faf0

Please sign in to comment.