~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/tutorial/exercise_service.py

Unbreak TestFramework's exception reporting mechanism, and report TestCreationErrors in test mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from ivle.webapp.base.rest import (JSONRESTView, named_operation,
25
25
                                   require_permission)
26
26
from ivle.webapp.errors import NotFound, BadRequest
 
27
from ivle.webapp.tutorial.test.TestFramework import TestCreationError
27
28
from ivle.worksheet.utils import test_exercise_submission
28
29
 
29
30
 
314
315
 
315
316
    @named_operation(u'edit')
316
317
    def test(self, req, code):
317
 
        return test_exercise_submission(req.config, req.user, self.context, code)
 
318
        try:
 
319
            return test_exercise_submission(
 
320
                req.config, req.user, self.context, code)
 
321
        except TestCreationError, e:
 
322
            return {'critical_error': {'name': 'TestCreationError', 'detail': e._reason}}