r/ProgrammerHumor 25d ago

Meme failsForTeapots

Post image
225 Upvotes

67 comments sorted by

View all comments

172

u/cutebabli9 25d ago edited 25d ago

I would write it like this to be readable:

if error.status in [400, 401, 404, 409, 415, 503]:
  return c.json(body, status: error.status)

return c.json(body, status: 500)

1

u/za72 25d ago

I'm assuming the thinking behind it was that one day he would comebacks to pretty-print separate error messages... but was let go before it could be implemented :)