284 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-2
votes
1
answer
85
views
The use of "finally" keyword in exception handling in Java [duplicate]
My question is about exception handling in Java.
If after a potential exception is handled in a try{} catch (){} block, and everything after that runs as usual, then why do we need finally{}?
I mean ...
1
vote
2
answers
86
views
Elegant way to chain two promises together and return the type of the second one?
I'm new to javascript and I have a question about promise chaining. I have two promises and want to return a promise that executes P2 after P1 regardless of whether P1 succeeded or failed, and return ...
0
votes
2
answers
423
views
C++Builder 12.2 error: "cannot use C++ 'try' in the same function as SEH '__try'"
After a computer crash and reinstallation of C++Builder 12.2 on a new computer, some code doesn't compile any more. For example:
void __fastcall TSynCustomExporter::CopyToClipboardFormat(UINT AFormat) ...
1
vote
2
answers
167
views
Is there a way to get all finally blocks across all threads to run when handling Ctrl+C in a Console Application
I have a console app that I want to be able to exit via ctrl+c. In my codebase/external libraries there are types which absolutely need their Dispose/Close() methods called for cleanup.
The suggested ...
-1
votes
1
answer
101
views
Python replacement for goto [closed]
Suppose I have a function that does a bunch of work in steps. Between each step I want to either continue or skip the rest of the steps. After the work is done an additional block of code should ...
1
vote
3
answers
83
views
How to send exception and return a value in the same method in java
I know it's not possibile throw exception and return a value in the same method, but i need to do this in somehow. I was thinking to use finally block to throw the exception and after return the value....
0
votes
1
answer
61
views
Javascript - document.write() outside a fetch promise erases what has been written inside it. Why?
There are two blocks of Javascript code. Same fetch, same API. One uses await, the other doesn't.
the document.write at the end erases was written in the finally block, but only if I use await,
If I ...
1
vote
2
answers
1k
views
What does "finally: pass" do in Python? (e.g. in try – except – finally)
I would have assumed a finally clause with only a pass to be pointless.
But in a Bottle template, the following code for an optional include would not work without it.
The result would contain ...
0
votes
3
answers
206
views
While loop vs recursion differences in try, except, finally error handling
What are the differences between using a while loop vs recursion in try, except, finally error handling?
When I use a while loop in user input error handling:
while True:
try:
user_num = ...
1
vote
1
answer
155
views
Is implicit finally block being applied for try statements other than try-with-resources?
Does implicit finally block exist for all try statements (try, try-finally, try-catch-finally) or only for try-with-resources?
4
votes
1
answer
89
views
JavaScript try catch finally block change precedence of errors
Sometimes I have a code in try-catch-finally block when finally branch does some cleanup code which may throw an Error. An error in the finally branch suppresses a possible error in the main branch. I ...
2
votes
1
answer
948
views
"Finally" equivalent for Swift?
https://nearthespeedoflight.com/browser.html
func untilThrowOrEndOfTokensReached<ConsumedType>(perform: () throws -> ConsumedType) -> [ConsumedType] {
var results = [ConsumedType](...
3
votes
1
answer
257
views
Progress 4GL, Is there a reason a buffer record would not be available in a finally block of an internal procedure? Is this expected behavior?
I have an internal procedure that defines a buffer for a temp table and creates a record for that tt using the buffer but the buffer is not available in the finally block
Example
define temp-table ...
0
votes
3
answers
154
views
Why would the loading indicator stay active if the promise was settled?
I was reading this article about Promise Basics on Javascript.info and came across an example about a usecase for the .finally() method.
It says:
The idea of finally is to set up a handler for ...
0
votes
2
answers
180
views
What is Kotlin's functional equivalent for finally?
This example is from the documentation of HttpUrlConnection:
URL url = new URL("http://www.android.com/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
...