orhun / rustypaste

A minimal file upload/pastebin service.
https://blog.orhun.dev/blazingly-fast-file-sharing
MIT License
757 stars 47 forks source link

Return appropriate HTTP status code instead of 500 #261

Closed orhun closed 5 months ago

orhun commented 5 months ago

There are some cases where we return 500 instead of an appropriate HTTP status code. We should refactor them to make the API more idiomatic/conventional.

One example is from https://github.com/orhun/rustypaste/pull/258#discussion_r1517736731

https://github.com/orhun/rustypaste/blob/4987cfe5e55e5fc6165fd8392b3c2396f6d34437/src/server.rs#L954-L955

We should use 409 Conflict there instead of 500 internal server error.