-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Background
There are situations where the A+ API returns non-successful HTTP responses for submissions. That might happen at least in certain cases when an exercise has already been closed (the response in that case is 400 Bad Request
. Juha can tell more about when this might happen in a semi-normal workflow).
Problem
When the API returns 4xx, plugin does not notice it as a failure. No message is shown to the user, the submission hash is added to the database of previous submissions, and also the log file says submission was successful.
Where does this happen in code?
CoursesClient.getInstance(project).postForm<Submit>(this@Submit, form) |
postForm
returns an HttpResponse
but its status is not checked. Even if it was 4xx, the execution just goes on.
How should it work?
If the HTTP response is not successful (2xx?), inform the user and write appropriate logs (and don't trigger post-submission procedures such as updating the database of previous submission hashes).