catch WebpackLoaderBadStatsError to prevent unittest concurrency errors

[LEARNER-1938]

try also catching WebpackLoaderBadStatsError
[LEARNER-1938]

catch BaseWebpackLoaderException also

do i need to import the exception?

add better logging
This commit is contained in:
Ari Rizzitano
2017-07-19 15:22:54 -04:00
parent 3d610fd78d
commit 038d5a1351

View File

@@ -93,6 +93,7 @@ source, template_path = Loader(engine).load_template_source(path)
</%doc>
<%
from django.template import Template, Context
from webpack_loader.exceptions import WebpackLoaderBadStatsError
try:
return Template("""
{% load render_bundle from webpack_loader %}
@@ -105,9 +106,9 @@ source, template_path = Loader(engine).load_template_source(path)
'entry': entry,
'body': capture(caller.body)
}))
except IOError as e:
except (IOError, WebpackLoaderBadStatsError) as e:
# Don't break Mako template rendering if the bundle or webpack-stats can't be found, but log it
logger.error(e)
logger.error('[LEARNER-1938] {error}'.format(error=e))
%>
</%def>