901 questions
2
votes
0
answers
156
views
Why catch block is ignored, and std::terminate is invoked? [duplicate]
I have a program that works as expected if compiled by GCC, but behaves weirdly after porting to Visual Studio.
The program throws an exception from noexcept(false) destructor (I know that it is a bad ...
3
votes
1
answer
168
views
Conditional operator with a throwing branch in Visual C++ 2026
My program changed its behavior after updating Visual Studio to the latest version (2026).
Simplifying it, I got the following minimal example, which contains a ternary operator with a throw in ...
0
votes
1
answer
36
views
Progress compile option 'requireReturnValues' fails with error throwing
I have set the compile option requireReturnValues="Error".
I tried to compile the following example code but it doesn't pass the option:
METHOD PUBLIC LOGICAL checkValue(i_cValue AS CHAR):
...
4
votes
1
answer
400
views
using throw in a constexpr or a consteval function in order to generate compile-time error
The problem
Using static_assert to generate compile-time error is not always easy because it requires a constant expression as first argument. I found, on StackOverflow, several example where throw ...
2
votes
1
answer
168
views
"Not all control paths return a value" when calling a function which throws [duplicate]
Example:
int foo() { throw 0; }
int bar() { foo(); }
foo here doesn't get a warning, while bar gets the error "must return a value". More typically, bar would have some return statements ...
-3
votes
1
answer
89
views
Is throw reachable after return statement in using context? [duplicate]
Is this throw statement even reachable?
It's not showing as unreachable by compiler.
public static async Task<List<string>> GetSomething(int id)
{
using (DbContext context = new ...
0
votes
0
answers
247
views
How to properly handle nested try/catch blocks within nested stored procedures?
I have multiple layers of nested stored procedures, each with a try...catch block within them. However, I want each of these nested stored procedures to be able to properly run their own transaction ...
0
votes
1
answer
58
views
Throw exceptions on non development enviroment Blazor
I have a Blazor Hosted WebAssembly app written on .NET8, so there are three projects Client, Server and the Shared. Intercommunication happends with Web API calls. In my razor components I have the ...
2
votes
2
answers
67
views
Example of using `linkOnly` from the async library
I found what I'd imagine to be a useful function in the illustrious async library that allows a thread to propagate an exception if and only if the exception passes a predicate - with a type of ...
0
votes
1
answer
123
views
Specific exception capture using throw in camel quarkus
I am currently working with Apache Camel in Quarkus and I need to catch an exception of the following type using throw, so that the class that calls it can handle it:
java.lang.Exception: Input byte ...
-1
votes
2
answers
145
views
why throw inside of an setTimeout, located inside a promise, doesn't change state and result of the output promise? [duplicate]
I know existence of a throw inside of a promise, change the state of that specific promise to rejected and the result will be the error message, but when I type this throw inside of a setTimeout ...
1
vote
1
answer
60
views
why promise has a weird precedence for errors in js?
I have the code below and I expect to first have hi in my console then the error and at the end why, but the result is: hi, then why and the last one is error, so I'm wondering, why is this happening?
...
0
votes
1
answer
92
views
why throw should be always between curly brace? [duplicate]
I had a situation like code below and since it's an arrow function and for a single line of code in arrow functions , no curly braces are required, I didn't use that and It works just fine.
const test ...
1
vote
1
answer
666
views
Should I use noexcept specifier and noexcept operator in most functions in C++?
I'm still new to the C++ programming language, and I'm trying to learn new things.
I'm implementing a very very basic iterator/reverse_iterator classes and other standard library containers.
I see in ...
-2
votes
1
answer
339
views
does throwing an error inside a do block leads to the catch block?
I have a do catch block with a function inside that can throw. In the catch block I throw a specific error. I'm interested in what happens when the function throws so I threw an error instead of the ...