Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
Wow i must have been brain dead when i wrote this code. Needed to exclude certain elements from response for the the list of objects.
for (obj : objects) {
If (obj.skipFromResponse()) {
break
}
add obj to response
}
I used break instead of continue at the if condition which meant it would break out of the loop at the first instance of condition being met.
This went through qa and has been in production for 4 weeks so how did this not break before. Well little did i know the list of objects was sorted and all the test data, qa data and everything so far in production coincidentally only had the last element with matching condition. This meant it returned everything correctly so far.
Today was the first time there was a situation where this caused incorrect output. Luckily as soon as I heard the description of the issue I remembered to check the merged PR and hung my head in shame for making such trivial error. I must have written way more complicated code without any problem but this made me embarrassed to even admit. 🤦♂️
rant
brain dead
story time