Election-Tech-Initiative / Election-Tech-Initiative/electionguard-api-python

Return 400 errors on deserialization failure

Open
#99 4 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue hacktoberfest help wanted
Dominant language
Python
Stars
37
Forks
29
PR merge metrics
No merged PRs in 30d

Description

## Feature Request

Until we have full Pydantic-compliant models (#98), we rely on custom deserialization in the routes, e.g.:

```python
ballots = [PlaintextBallot.from_json_object(ballot) for ballot in request.ballots]
```

If this deserialization fails, however, it manifests as an opaque `500` error to the client. We should capture deserialization errors and send a `400` with as much information as possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.