Ranter
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
Comments
-
Konsole31215y> why use if else if we have exceptions
In some cases actually using exceptions is better than if else. Python recommends it in a lot of places -
I hate the misuse of exceptions. Some of my collegues would use them for everything.
Following their logic, it would be ok for an IsEmpty() method to throw an exception for the case that the list not empty. 😞 -
I feel bad for that last catch block. It feel like someone gave up on the dream of bulletproof code.
found this in our codebase today
try {
//do something
} catch () {
try {
//do something else
} catch () {
try {
//do something else else... this goes on 4-5 levels deep
} catch () {
//log... couldn't do
}
}
}
rant
catchception
why use if else when we have exceptions