Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#3084 closed change (fixed)

[cms] Show full tracebacks for exceptions passing template code

Reported by: sebastian Assignee: sebastian
Priority: P4 Milestone:
Module: Sitescripts Keywords:
Cc: trev, kzar Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29327966

Description (last modified by sebastian)

Background

When an exception, is raised in, or passes a jinja template the traceback usually includes the template code. However, when using the CMS the filename is unknown, and therefore the traceback is incomplete. That makes debugging quite difficult.

What to change

Make Source.read_file() return a data structure that contains the data as well as the filename and pass it up to the Converter and template loader. Then make the TemplateConverter pass the filename to jinja2, that exceptions will have a complete and correct traceback.

Additionally, we have to pass the filename to compile() when loading custom template filters and globals. Otherwise the traceback will be incomplete there as well.

Change History (3)

comment:1 Changed 4 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 4 years ago by sebastian

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.