Skip to content

Commit

Permalink
[#1011] base.py: Explicitly re-raise TemplateNotFound
Browse files Browse the repository at this point in the history
Functions should not implicitly raise exceptions by failing to catch
exceptions raised by functions that they call, they should explicitly
catch and re-raise the exceptions instead.
  • Loading branch information
Sean Hammond committed Aug 26, 2013
1 parent 98508d1 commit 2d3bcdd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ckan/lib/base.py
Expand Up @@ -104,7 +104,10 @@ def render_template():
# we remove it so any bad templates crash and burn
del globs['url']

template_path, template_type = render_.template_info(template_name)
try:
template_path, template_type = render_.template_info(template_name)
except render_.TemplateNotFound:
raise

# snippets should not pass the context
# but allow for legacy genshi templates
Expand Down Expand Up @@ -202,6 +205,8 @@ def render_template():
raise ckan.exceptions.CkanUrlException(
'\nAn Exception has been raised for template %s\n%s' %
(template_name, e.message))
except render_.TemplateNotFound:
raise


class ValidationException(Exception):
Expand Down

0 comments on commit 2d3bcdd

Please sign in to comment.