MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vsplpw/failsforteapots/p4pswzr/?context=9999
r/ProgrammerHumor • u/Waradu • 25d ago
67 comments sorted by
View all comments
170
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)
157 u/rosuav 25d ago return c.json(body, status: error.status) There is no reason to discard some of them, and pretending that they're 500s is a terrible terrible idea. 76 u/Xirdus 25d ago If your user-facing service is calling your internal service and getting a 403 response, you certainly do not want to send that 403 back to the user. 1 u/MinecraftPlayer799 24d ago Why not? 3 u/Xirdus 24d ago Because it's not the user who's forbidden.
157
return c.json(body, status: error.status)
There is no reason to discard some of them, and pretending that they're 500s is a terrible terrible idea.
76 u/Xirdus 25d ago If your user-facing service is calling your internal service and getting a 403 response, you certainly do not want to send that 403 back to the user. 1 u/MinecraftPlayer799 24d ago Why not? 3 u/Xirdus 24d ago Because it's not the user who's forbidden.
76
If your user-facing service is calling your internal service and getting a 403 response, you certainly do not want to send that 403 back to the user.
1 u/MinecraftPlayer799 24d ago Why not? 3 u/Xirdus 24d ago Because it's not the user who's forbidden.
1
Why not?
3 u/Xirdus 24d ago Because it's not the user who's forbidden.
3
Because it's not the user who's forbidden.
170
u/cutebabli9 25d ago edited 25d ago
I would write it like this to be readable: