|
Posted
over 13 years
ago
by
[email protected]
(mark)
Just to add my thoughts to this... I'd agree with Bevan, while this may not strictly adhere to the ideal, extra information is always useful. I have a slight quibble with the name of this rule - ' DoNotSwallowErrorsCatchingNonS
|
|
Posted
over 13 years
ago
by
[email protected]
(Andres G. Aragoneses)
You can still do that, but wrapping specific exceptions you expect. If you answer to that "but I don't know all the exceptions I can expect", I would reply "that is reasonable, but then any non-expected exception should not be wrapped, otherwise you add noise and make the problem more difficult to fix".
|
|
Posted
over 13 years
ago
by
[email protected]
(Luping)
Basically I agree with you. But, I want to handle all exceptions in the top tier, that's why in the others tiers, I have created a series of personals exceptions like DALException, ServiceException ...... to wrap and rethrow those originals exceptions. Le samedi 30 juin 2012 05:28:37 UTC+2, Bevan a écrit :
|
|
Posted
over 13 years
ago
by
[email protected]
(Bevan Arps)
Catching Exception (and not a derived class) in order to wrap the original exception with additional information to give context for the original error is a pretty common pattern, at least in the code I've encountered. The key is that you're not
|
|
Posted
over 13 years
ago
by
[email protected]
(Andres G. Aragoneses)
It *is* a real violation because you're catching Exception instead of a derived class of Exception. Normally apps have an isolated place with a catch-all though, but just one. And this is the only one which you should add to your Gendarme ignore-list.
|
|
Posted
over 13 years
ago
by
[email protected]
(Luping)
I have created a new personal exception named DALException. In the data tier of my application, I wrap the exception catched “e” into this personal exception and rethrow it to the higher tier, but I got a violation “DoNotSwallowErrorsCatchingNon SpecificExceptionsRule”. I don’t think this
|
|
Posted
over 13 years
ago
by
[email protected]
(Leszek Ciesielski)
Do you mean something like this: [link] ? There's not API, it's just calling the command line tool.
|
|
Posted
over 13 years
ago
by
[email protected]
(Andre Broers)
I'd like to have an api to call to create my own msbuild task. Is this available and documented? Andre
|
|
Posted
over 13 years
ago
by
[email protected]
(Kulvinder Singh)
I'm running in to this too, here is a link to the commit Jb made: [link] (couldn't get Google to find it from the UID). I'll keep an eye out for news too.
|
|
Posted
over 13 years
ago
by
[email protected]
(Ty)
Jb, I am running into similar problems like Alik posted earlier. I downloaded the new 2.11 version of gendarme (gendarme-2.11-snapshot-201103 05-win32-setup), but the problem is still there. Wondering if your hot fix has been included into new 2.11 version release. BTW, I am totally new to using sonar .NET plugin, can you point me to where
|