Give the user better diagnostic information when they don't have access to a Canvas file
- Dominant language
- Python
- Stars
- 53
- Forks
- 16
- Avg merge
- 14d 5h
- Merged PRs (30d)
- 14
Description
When a teacher uploads a PDF file to a Canvas course in the **Files** tab they can set the file to **Unpublished** like so:

The teacher still has access to the file and can create and launch an assignment that uses this file successfully. But students can't launch an assignment that uses an unpublished file. They get into an **Authorize Hypothesis** loop:

## Desired behaviour
Putting the user into an infinite loop is fine -- they won't be able to launch the assignment until an instructor publishes the file in Canvas, and all we can do is give them a way to keep trying.
But it would be good if we could give the students some information about _why_ it failed and what must be done to fix it in this case, so they can report it to their instructors.
When the user doesn't have permission to access the file in Canvas our `public_url` Canvas API request gets a particular response:
```
401 Unauthorised
{"status": "unauthorised", "errors": [{"message": "user not authorised to perform that action"}]}
```
Unfortunately both the `"status": "unauthorised"` and the `"message": "user not authorised to perform that action"` are unreliable because they have been localised into the local language of the user's Canvas account (British English in this case).
So can we distinguish this particular case from others based solely on the 401 response code?
If we can then I think it would be desirable to show an error page explaining that the user doesn't have access to the file in Canvas and the instructor needs to give them access. Something like this:

The **Details** would include the full details of the 401 Unauthorized JSON response from Canvas, as usual.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.