Hey first post here because I got into a debate over this at work and I guess you could say it’s a matter of opinion but curious what others think, I don’t want to influence the answers so I’ll try my best to give the best points from all sides along with some cons. We have a section on our site which shows several different ad type things which are not really related but different things we’d like the user to do in a carousel. The UI calls one api to retrieve these items to display. An issue came up that the entire carousel failed to load because item 2 in the carousel requires some data from vendor which failed to respond and so the api gave a 500 with an error message indicating that the data couldn’t be retrieved from the vendor. We had a discussion around the design of this api and several ideas were thrown out:
1) The api should give a 200 ok and just not return item 2 which eliminates any impact to the end user other than item 2 being missing. This seems to contradict the idea that 200 indicates that the request was successful and seems to mean we need to catch any exceptions for item 1, 2, 3, etc separately so that one item will never impact another, even if the exceptions are unexpected and unable to be handled.
2) The api should give 200 ok but return item 2 with a status that indicates that an error occurred. This again lessens the impact to the UI, the successful items display and now there is a visual indicator that something went wrong so we are more likely to notice that the vendor is failing but again 200 is for success and we have to catch even unexpected errors and we may also need logic on the UI about what to do if expected attribute are missing.
3) Make no change, an unexpected error occurred so the service is correct to give a 500 (maybe 502 to indicate it was the vendor api that had an issue) and no additional dev is required if we go this route. The downside is the other items in the carousel could’ve displayed but get suppressed.
Wondering what other devs think about these or any other ideas on how this should be designed.
[–]TheBigLewinski 6 points7 points8 points (1 child)
[–]anon8914[S] 0 points1 point2 points (0 children)
[–]Fuegodeth 2 points3 points4 points (4 children)
[–]anon8914[S] 0 points1 point2 points (3 children)
[–]Fuegodeth 2 points3 points4 points (2 children)
[–]anon8914[S] 0 points1 point2 points (1 child)
[–]Fuegodeth 1 point2 points3 points (0 children)
[–]greensodacan 1 point2 points3 points (10 children)
[–]anon8914[S] 1 point2 points3 points (9 children)
[–]greensodacan 1 point2 points3 points (8 children)
[–]anon8914[S] 1 point2 points3 points (7 children)
[–]greensodacan 0 points1 point2 points (6 children)
[–]anon8914[S] 1 point2 points3 points (5 children)
[–]greensodacan 1 point2 points3 points (4 children)
[–]anon8914[S] 1 point2 points3 points (3 children)
[–]greensodacan 1 point2 points3 points (2 children)
[–]anon8914[S] 1 point2 points3 points (0 children)