allura
修訂 | aa3b05da5b0e281b5116ad4c73aa76ac3a81fa13 (tree) |
---|---|
時間 | 2012-03-15 07:00:58 |
作者 | Dave Brondsema <dbrondsema@geek...> |
Commiter | Dave Brondsema |
[#3895] tighter error handling and less scary message, for notification templates
Signed-off-by: Dave Brondsema <dbrondsema@geek.net>
@@ -156,11 +156,13 @@ class Notification(MappedClass): | ||
156 | 156 | ''' Add addional text to the notification e-mail based on the artifact type ''' |
157 | 157 | template = cls.view.get_template('mail/' + artifact.type_s + '.txt') |
158 | 158 | d['text'] += template.render(dict(c=c, g=g, config=config, data=artifact)) |
159 | - except Exception, e: | |
159 | + except jinja2.TemplateNotFound: | |
160 | + pass | |
161 | + except: | |
160 | 162 | ''' Catch any errors loading or rendering the template, |
161 | 163 | but the notification still gets sent if there is an error |
162 | 164 | ''' |
163 | - log.debug('Error rendering notification template %s: %s' % (artifact.type_s, e)) | |
165 | + log.warn('Could not render notification template %s' % artifact.type_s, exc_info=True) | |
164 | 166 | |
165 | 167 | assert d['reply_to_address'] is not None |
166 | 168 | project = Project.query.get(_id=d.get('project_id', c.project._id)) |