Provide reasonable error message when accessing grade data non-existent flow
- Dominant language
- Python
- Stars
- 435
- Forks
- 124
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 14
Description
A scenario in which this can happen is
* Preview branch with newly created flow
* Switch back to master branch
* Whoops, flow is gone
Currently, this results in a server error with this traceback:
```
File "./course/content.py" in get_repo_blob
268. mode, blob_sha = access_directory_content(tree, names[-1])
File "./course/content.py" in access_directory_content
244. mode_and_blob_sha = maybe_tree[name.encode()]
File "/home/andreas/my-relate-env3/lib/python3.6/site-packages/dulwich/objects.py" in __getitem__
936. return self._entries[name]
During handling of the above exception (b'exam_1.yml'), another exception occurred:
File "/home/andreas/my-relate-env3/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
35. response = get_response(request)
File "/home/andreas/my-relate-env3/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "/home/andreas/my-relate-env3/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "./course/utils.py" in wrapper
792. response = f(pctx, *args, **kwargs)
File "./course/grading.py" in grade_flow_page
154. pctx.course.identifier, respect_preview=False)
File "./course/flow.py" in adjust_flow_session_page_data
301. flow_session.flow_id, commit_sha)
File "./course/content.py" in get_flow_desc
1397. flow_desc = get_yaml_from_repo(repo, "flows/%s.yml" % flow_id, commit_sha)
File "./course/content.py" in get_yaml_from_repo
620. repo, full_name, commit_sha, allow_tree=False).data
File "./course/content.py" in get_repo_blob
278. raise ObjectDoesNotExist(_("resource '%s' not found") % full_name)
Exception Type: ObjectDoesNotExist at /course/cs450-f18/grading/flow-page/428358/2/
Exception Value: resource 'flows/exam_1.yml' not found
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in course/content.py at get_repo_blob and follow the call path through get_yaml_from_repo, course/flow.py, and course/grading.py. Reproduce the missing-flow scenario after switching branches, then verify that accessing the absent flow produces a reasonable user-facing error instead of the shown server traceback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100