[API] event not found should raise a 404, not a 500
Description
When an object does not exist in the system, the API should return a 404, not a 500.
Client side, 5xx errors are retry-able whereas 4xx errors are not. Returning a wrong class of error disrupts the client business logic and generates needless retries on server.
Steps to Reproduce
- as an actor, create an event
- as the same actor, delete this event
- as the same actor, update or delete this already deleted event
Expected behaviour:
404 event not found
Actual behaviour:
{"code": "unknown_error", "field": None, "locations": [{"column": 3, "line": 2}], "message": "événement non trouvé", "path": ["updateEvent"], "status_code": 500}
Reproduces how often:
100%
Versions
2.0.2
Additional Information
for event see https://framagit.org/framasoft/mobilizon/-/blob/main/lib/graphql/resolvers/event.ex#L359 and https://framagit.org/framasoft/mobilizon/-/blob/main/lib/graphql/resolvers/event.ex#L411
and probably there : https://framagit.org/framasoft/mobilizon/-/blob/main/lib/graphql/error.ex#L100