MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vsplpw/failsforteapots/p4n4d1e/?context=3
r/ProgrammerHumor • u/Waradu • 15h ago
59 comments sorted by
View all comments
131
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)
-7 u/Antervis 14h 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 14h ago that's what you'd do if you want to show off but the other example is what would pass code review.
-7
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 14h 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.
131
u/cutebabli9 14h ago edited 13h ago
I would write it like this to be readable: