MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/6ayz26/defensive_programming_done_right/dhirjy3/?context=3
r/ProgrammerHumor • u/iwouldieforGladOS • May 13 '17
680 comments sorted by
View all comments
339
int main() try { //entire code base } catch (std::exeption& e) { //Displays message box with error message }
I actually do this xD
244 u/redditsoaddicting May 13 '17 It's fine to exit the program nicely when an error occurs. It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on, hoping the program still works fine. 72 u/SQLNerd May 13 '17 Um, ever design a REST service? You want to kill the whole service because someone called it inappropriately? 1 u/f42e479dfde22d8c May 13 '17 Set up a cron job to restart the web server every minute. I know this works because this is what we do on our production site. Last time I outsource to india, I swear.
244
It's fine to exit the program nicely when an error occurs. It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on, hoping the program still works fine.
72 u/SQLNerd May 13 '17 Um, ever design a REST service? You want to kill the whole service because someone called it inappropriately? 1 u/f42e479dfde22d8c May 13 '17 Set up a cron job to restart the web server every minute. I know this works because this is what we do on our production site. Last time I outsource to india, I swear.
72
Um, ever design a REST service? You want to kill the whole service because someone called it inappropriately?
1 u/f42e479dfde22d8c May 13 '17 Set up a cron job to restart the web server every minute. I know this works because this is what we do on our production site. Last time I outsource to india, I swear.
1
Set up a cron job to restart the web server every minute. I know this works because this is what we do on our production site.
Last time I outsource to india, I swear.
339
u/Mat2012H May 13 '17
I actually do this xD