A swallowed exception refers to an anti-pattern in which an exception is thrown but never gets handled. A swallowed exception is not logged, re-thrown or used to dictate the flow of the program.
Questions tagged [swallowed-exceptions]
12 questions
44
votes
16 answers
Why do programmers sometimes silently swallow exceptions?
I know it's evil, but I've seen swallowed exceptions in code written by a good programmer. So I'm wondering if this bad practice could have at least one positive point.
In other words, it is bad but why do good programmers, on rare occasions, use…

JiBéDoublevé
- 4,124
- 4
- 36
- 57
28
votes
3 answers
How to catch any Javascript exception in Clojurescript?
In my communication layer I have a need to be able to catch ANY javascript exception, log it down and proceed as I normally would do.
Current syntax for catching exceptions in Clojurescript dictates that I need to specify the type of the exception…

Dima B.
- 281
- 1
- 3
- 3
24
votes
1 answer
What causes an InvalidDeploymentException in a WPF application?
I developed a WPF application and when I launch it in the debug mode I see the following in the output:
'WpfApplication1.vshost.exe' (Managed
(v2.0.50727)): Loaded
…

Kirill Lykov
- 1,293
- 2
- 22
- 39
6
votes
6 answers
Is there a way to force JUnit to fail on ANY unchecked exception, even if swallowed
I am using JUnit to write some higher level tests for legacy code that does not have unit tests.
Much of this code "swallows" a variety of unchecked exceptions like NullPointerExceptions (e.g., by just printing stack trace and returning null).…

Uri
- 88,451
- 51
- 221
- 321
4
votes
1 answer
VS2010 did not break debug on static constructor exception
I have a Windows Forms application with a single Editor class (that inherits from Form).
public partial class Editor : Form
{
public Editor()
{
InitializeComponent();
Load += Editor_Load;
}
private void…

Kornelije Petak
- 9,412
- 15
- 68
- 96
3
votes
1 answer
How to pass a reference to a STATIC method as a function parameter in C#?
I need to use a Swallow(Func) method from NLog library.
Important note: I call Swallow from a static method and want to pass a static method.
Its documentation is…

Sold Out
- 1,321
- 14
- 34
3
votes
2 answers
powershell call to extended property fails silently ( Added via Update-TypeData )
My questions are:
Why is this error not being thrown out into the code?
How can I make the error get thrown up into the code?
Where / How could I have figured this out on my own? / Where is the documentation for this "feature"?
Function…

Jeff Maass
- 3,632
- 3
- 26
- 30
1
vote
1 answer
How to bypass an error dialog when calling a C++ executable from MATLAB?
I need to run a C++ executable from a for loop in MATLAB. I have written the following piece of code for the purpose,
EqNumbers = [17 18 20 21 22 23];
for i = 1:length(EqNumbers)
EqNumber = EqNumbers(i);
WriteRunE_File(EqNumber);
…

The_Learner
- 589
- 1
- 6
- 16
1
vote
1 answer
Powershell is swallowing REST error response
I am using Invoke-WebRequest in Powershell and whenever my request is determined to be invalid by the targeted API endpoint, it obviously denies the request and sends back an HTTP error code like (400) Bad Request but it also includes the reason for…

vin_Bin87
- 318
- 8
- 18
0
votes
0 answers
Is there a way to get rid of `regenerator-runtime/runtime` in jest tests?
I am using react-native-testing-library in order to test my app, and I found out that "regenerator-runtime/runtime" swallows critical errors in my app, so I am trying now to get rid of it. I also found out that react-native/jest/setup.js brings this…

niryo
- 1,275
- 4
- 15
- 26
0
votes
0 answers
QT test fail on exception and continue next test rather than abort
I've had a look at some of the qtest source code and documentation and can't figure it out.
Would like to run tests and have test cases fail if an exception is thrown, and then continue on to the next test.
Is there a way short of recompiling qt…

codeMetis
- 420
- 4
- 16
0
votes
1 answer
Is there a way to make Binding class throw back exceptions raised in bound objects?
Consider the following class:
public class Toto
{
string _Test = "try me!";
public string Test
{
get { return _Test; }
set { throw new Exception("This shouldn't be swallowed."); }
}
…

Crono
- 10,211
- 6
- 43
- 75