|
16 | 16 |
|
17 | 17 | from ...apps import NbGrader |
18 | 18 | from ...coursedir import CourseDirectory |
19 | | -from ...exchange import ExchangeList, ExchangeFetchAssignment, ExchangeFetchFeedback, ExchangeSubmit |
| 19 | +from ...exchange import ExchangeList, ExchangeFetchAssignment, ExchangeFetchFeedback, ExchangeSubmit, ExchangeError |
20 | 20 | from ...auth import Authenticator |
21 | 21 | from ... import __version__ as nbgrader_version |
22 | 22 |
|
@@ -76,13 +76,23 @@ def list_released_assignments(self, course_id=None): |
76 | 76 | config=config) |
77 | 77 | assignments = lister.start() |
78 | 78 |
|
79 | | - except: |
| 79 | + except Exception as e: |
80 | 80 | self.log.error(traceback.format_exc()) |
81 | | - retvalue = { |
82 | | - "success": False, |
83 | | - "value": traceback.format_exc() |
84 | | - } |
85 | | - |
| 81 | + if isinstance(e, ExchangeError): |
| 82 | + retvalue = { |
| 83 | + "success": False, |
| 84 | + "value": """The exchange directory does not exist and could |
| 85 | + not be created. The "release" and "collect" functionality will not be available. |
| 86 | + Please see the documentation on |
| 87 | + http://nbgrader.readthedocs.io/en/stable/user_guide/managing_assignment_files.html#setting-up-the-exchange |
| 88 | + for instructions. |
| 89 | + """ |
| 90 | + } |
| 91 | + else: |
| 92 | + retvalue = { |
| 93 | + "success": False, |
| 94 | + "value": traceback.format_exc() |
| 95 | + } |
86 | 96 | else: |
87 | 97 | for assignment in assignments: |
88 | 98 | if assignment['status'] == 'fetched': |
@@ -111,13 +121,23 @@ def list_submitted_assignments(self, course_id=None): |
111 | 121 | config=config) |
112 | 122 | assignments = lister.start() |
113 | 123 |
|
114 | | - except: |
| 124 | + except Exception as e: |
115 | 125 | self.log.error(traceback.format_exc()) |
116 | | - retvalue = { |
117 | | - "success": False, |
118 | | - "value": traceback.format_exc() |
119 | | - } |
120 | | - |
| 126 | + if isinstance(e, ExchangeError): |
| 127 | + retvalue = { |
| 128 | + "success": False, |
| 129 | + "value": """The exchange directory does not exist and could |
| 130 | + not be created. The "release" and "collect" functionality will not be available. |
| 131 | + Please see the documentation on |
| 132 | + http://nbgrader.readthedocs.io/en/stable/user_guide/managing_assignment_files.html#setting-up-the-exchange |
| 133 | + for instructions. |
| 134 | + """ |
| 135 | + } |
| 136 | + else: |
| 137 | + retvalue = { |
| 138 | + "success": False, |
| 139 | + "value": traceback.format_exc() |
| 140 | + } |
121 | 141 | else: |
122 | 142 | for assignment in assignments: |
123 | 143 | assignment["submissions"] = sorted( |
|
0 commit comments