4 ms·
Is this really about testing? > If (the database throws an error) { do nothing } It's paraphrased, the original was probably the C++ anti pattern of > try {
by 08-15 8y ago
Is this really about testing?
> If (the database throws an error) { do nothing }
It's paraphrased, the original was probably the C++ anti pattern of
> try { /some code/ } catch {...} {}
Whoever wrote this should be disciplined. This kind of code doesn't do anything, it just makes a bad situation worse. (It's also never tested, because who writes tests that provoke failures?) This kind of idiocy has no technical solution, unless the two-by-four counts.
If you're ever tempted to write something like this... don't. Especially in C++, the correct approach is to do nothing. Someone else will handle the exception. Code that isn't written doesn't cause trouble and doesn't need to be tested either.