Top "Try-finally" questions

try-finally is a clause used to define a block of code which may throw an exception along with instructions to execute regardless of whether an exception occurs or not.

Why does changing the returned variable in a finally block not change the return value?

I have a simple Java class as shown below: public class Test { private String s; public String foo() { try { s = "…

java try-finally
Does the statements in the Finally block still execute in this piece of code ?

Will finally block execute? if I pass exit; ? procedure someProc; begin Try Exit; finally do_something; end; end;

delphi try-finally
How to determine if an exception was raised once you're in the finally block?

Is it possible to tell if there was an exception once you're in the finally clause? Something like: try: funky …

python exception logging control-flow try-finally
How to simulate try-finally or try-except in languages that don't have them

Is there any way to simulate a try-finally or try-except in a language that doesn't have them? If there's some …

exception-handling lua try-catch try-finally
Will the 'finally' block fire even after a Junit test throws an Assertion Error from with in 'try' block?

Will the writer.close() method inside the finally { } block run on an Junit Assertion Error? Assume the following code: @Test …

java unit-testing junit junit4 try-finally
await in try-finally block

I've been playing around with the Visual Studio 14 CTP 2. This version of C# vNext enables the use of the await …

c# compiler-construction async-await try-finally c#-6.0
getting asynchronous socket error 10049 even if i use try..except

when ever i run my program(outside the debugger/ide) i get error asynchronous socket error 10049, am i not supposed …

delphi sockets exception-handling try-finally tclientsock