Switch to side-by-side view

--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -23,6 +23,8 @@
 
 import pymongo
 from pylons import tmpl_context as c, app_globals as g
+from tg import config
+from paste.deploy.converters import asbool
 
 import ming
 from ming.utils import LazyProperty
@@ -257,13 +259,16 @@
             self.state = 'complete'
             return self.result
         except Exception, exc:
-            log.exception('Error "%s" on job %s', exc, self)
-            self.state = 'error'
-            if hasattr(exc, 'format_error'):
-                self.result = exc.format_error()
-                log.error(self.result)
+            if asbool(config.get('monq.raise_errors')):
+                raise
             else:
-                self.result = traceback.format_exc()
+                log.exception('Error "%s" on job %s', exc, self)
+                self.state = 'error'
+                if hasattr(exc, 'format_error'):
+                    self.result = exc.format_error()
+                    log.error(self.result)
+                else:
+                    self.result = traceback.format_exc()
         finally:
             self.time_stop = datetime.utcnow()
             session(self).flush(self)