Hacker News new | ask | show | jobs
by matt_craig 647 days ago
Is it that the defer() that recovers is called before the defer() that closes (and potentially fails)?
1 comments

No. No rearranging of the code would fix the problem.
Hmm. Checked the docs, looks like os.Create returns *File and err, but the sample doesn’t check that error.
os.Create, per the topic of discussion, is said to throw an error using the exception handling mechanism rather than return error. The exception handler checks the error.

If you focus on errors, you’re going to never get it. The whole idea here is that the problem is bigger than errors.