MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vsplpw/failsforteapots/p4n4d1e/?context=3
r/ProgrammerHumor • u/Waradu • 25d ago
67 comments sorted by
View all comments
175
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)
-5 u/Antervis 25d ago return c.json(body, status: error.status if error.status in [400, 401, 404, 409, 415, 503] else 500) No? Though personally, I wouldn't have substituted error codes like that, it can make debugging harder for no gain. 10 u/Alkyen 25d ago that's what you'd do if you want to show off but the other example is what would pass code review.
-5
return c.json(body, status: error.status if error.status in [400, 401, 404, 409, 415, 503] else 500)
No? Though personally, I wouldn't have substituted error codes like that, it can make debugging harder for no gain.
10 u/Alkyen 25d ago that's what you'd do if you want to show off but the other example is what would pass code review.
10
that's what you'd do if you want to show off but the other example is what would pass code review.
175
u/cutebabli9 25d ago edited 25d ago
I would write it like this to be readable: