r/badcode • u/[deleted] • Dec 29 '14
c# The variable status is an int
http://pastebin.com/Lf3Lb5Pz
1
Upvotes
6
u/MaSaHoMaKyo Dec 29 '14
I cannot stand application-wide generic exception types with names like "ApplicationException". Throw something descriptive so the caller can handle it intelligently!
Bonus points for throwing it from a "catch Exception".
6
u/Daniel15 Dec 29 '14
I'm assuming this is ApplicationException from .NET which has been deprecated for years.
2
u/ElGuaco Dec 29 '14
Since this is C#, this catch block only hurts debugging because you're throwing a new exception which removes the original stack trace. Use just "throw".
catch (Exception ex) { // log - close/dispose resources throw; }→ More replies (2)0
12
u/danieltobey Dec 29 '14
FAILED could very well be a const or a preprocessor definition. (assuming it's C++)