Skip to content

Submission fails silently when the API responses with an error #1204

@OlliKiljunen

Description

@OlliKiljunen

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbug-buggy-bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions