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

I agree with your points about Java. I have direct experience with suppressed exceptions in Java 6 -- it was painful to debug ("where did my exception go???"). However, this works because Java forces everything thrown to be a sub-class of Throwable. (Please correct me if wrong.) C++ allows you to throw anything, including (bizarrely) null. I learned recently that C# allows the same -- you can throw null(!). How does C# handle suppressed exceptions?


In C#, if the finally-block of a try-finally throws, it replaces the current exception altogether; and using-statement desugars into try-finally.

And C# does not actually allow you to throw null. It does allow you to write "throw x" where x may be null, but that will just cause an immediate NullReferenceException at runtime.




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

Search: