Interesting read. Thanks for trying out these scenarios. I like how it suppresses both close failures when there is a work failure, and let the work failure propagate up. That is what the caller would most likely care about.
I was a little surprised by the r2 create failure scenario, where it closes r1 before the catch block. I would have thought the closure would happen in an auto-generated finally block. However come to think of it, that actually makes sense because it gives the catch block a chance to handle close failures.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Interesting read. Thanks for trying out these scenarios. I like how it suppresses both close failures when there is a work failure, and let the work failure propagate up. That is what the caller would most likely care about.
I was a little surprised by the r2 create failure scenario, where it closes r1 before the catch block. I would have thought the closure would happen in an auto-generated finally block. However come to think of it, that actually makes sense because it gives the catch block a chance to handle close failures.