Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Please no. Just handle errors from `close()` when you're writing files.

> On modern hardware if a disk is throwing an io error on write you are having a bad day.

And how would you know you're having a bad day if apps ignore those errors?



I'm arguing that the proper thing to do here is to kill the process along with whatever else is using the block device.

Whether you handle the error or immediately or if you allow the error to occur after a defer, you still are almost certainly not handling it properly and are taking a speed hit for your troubles.


Absolutely not. Imagine a text editor failing when I hit save. Do you really want that to crash the application? No. You want a fallback to ctrl+A ctrl+C, paste into a email and send to yourself. Giving the user a choice to save on a different drive is also a possibility, maybe your thumb drive just got a nudge and lost connection for a second.

This is really all normal use cases under normal conditions.


Using signals for this really sucks. Anyways, you don't get to do this now because of backwards-compatibility. Just handle the error.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: