Capture ExportTemplate rendering errors more elegantly #2529

Closed
opened 2025-12-29 18:19:40 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Apr 18, 2019).

Environment

  • Python version: 3.5.6
  • NetBox version: 2.5.10

Proposed Functionality

Currently, if an ExportTemplate is saved with invalid template code and then run, it will raise an exception which is handled like any other server error (500). Ideally, we should capture the template rendering error and present it in some more elegant fashion so that the user is immediately aware that it's a bug in the template rather than NetBox itself.

Use Case

This would allow for quicker identification of template errors.

Database Changes

None

External Dependencies

None

Originally created by @jeremystretch on GitHub (Apr 18, 2019). ### Environment * Python version: 3.5.6 * NetBox version: 2.5.10 ### Proposed Functionality Currently, if an ExportTemplate is saved with invalid template code and then run, it will raise an exception which is handled like any other server error (500). Ideally, we should capture the template rendering error and present it in some more elegant fashion so that the user is immediately aware that it's a bug in the template rather than NetBox itself. ### Use Case This would allow for quicker identification of template errors. ### Database Changes None ### External Dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 18:19:40 +01:00
adam closed this issue 2025-12-29 18:19:40 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 2, 2019):

I should point out that we are already catching TemplateSyntaxError. This extends that logic to catch any exception raised during rendering of the template.

@jeremystretch commented on GitHub (May 2, 2019): I should point out that we are already catching TemplateSyntaxError. This extends that logic to catch _any_ exception raised during rendering of the template.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2529