Is there any reason to put code in a finally
block as opposed to just having code after the try...catch
statement. Surely in both cases the code gets run anyway
try {
something();
} catch (error) {
error_handling_with(error);
}
// code here gets executed whether in finally clause or not.
finally_something();
Is there any place where finally
is essential after try...catch
? I can see it has a use in Promises, just not here.