Skip to content

Commit 7825e0c

Browse files
committed
Improve the error message on the assignments page in the case that the exchange does not exist
1 parent a9ee8d2 commit 7825e0c

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

nbgrader/server_extensions/assignment_list/handlers.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ...apps import NbGrader
1818
from ...coursedir import CourseDirectory
19-
from ...exchange import ExchangeList, ExchangeFetchAssignment, ExchangeFetchFeedback, ExchangeSubmit
19+
from ...exchange import ExchangeList, ExchangeFetchAssignment, ExchangeFetchFeedback, ExchangeSubmit, ExchangeError
2020
from ...auth import Authenticator
2121
from ... import __version__ as nbgrader_version
2222

@@ -76,11 +76,16 @@ def list_released_assignments(self, course_id=None):
7676
config=config)
7777
assignments = lister.start()
7878

79-
except:
79+
except ExchangeError:
8080
self.log.error(traceback.format_exc())
8181
retvalue = {
8282
"success": False,
83-
"value": traceback.format_exc()
83+
"value": """The exchange directory does not exist and could
84+
not be created. The "release" and "collect" functionality will not be available.
85+
Please see the documentation on
86+
http://nbgrader.readthedocs.io/en/stable/user_guide/managing_assignment_files.html#setting-up-the-exchange
87+
for instructions.
88+
"""
8489
}
8590

8691
else:
@@ -111,11 +116,16 @@ def list_submitted_assignments(self, course_id=None):
111116
config=config)
112117
assignments = lister.start()
113118

114-
except:
119+
except ExchangeError:
115120
self.log.error(traceback.format_exc())
116121
retvalue = {
117122
"success": False,
118-
"value": traceback.format_exc()
123+
"value": """The exchange directory does not exist and could
124+
not be created. The "release" and "collect" functionality will not be available.
125+
Please see the documentation on
126+
http://nbgrader.readthedocs.io/en/stable/user_guide/managing_assignment_files.html#setting-up-the-exchange
127+
for instructions.
128+
"""
119129
}
120130

121131
else:

0 commit comments

Comments
 (0)