Click here to Skip to main content
15,886,963 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: What are we doing to our kids? Pin
john morrison leon17-Feb-23 4:06
john morrison leon17-Feb-23 4:06 
GeneralRe: What are we doing to our kids? Pin
Dan Sutton17-Feb-23 6:56
Dan Sutton17-Feb-23 6:56 
GeneralRe: What are we doing to our kids? Pin
jschell17-Feb-23 10:34
jschell17-Feb-23 10:34 
GeneralRe: What are we doing to our kids? Pin
Dan Sutton17-Feb-23 16:07
Dan Sutton17-Feb-23 16:07 
GeneralRe: What are we doing to our kids? Pin
Mirko79617-Feb-23 8:46
Mirko79617-Feb-23 8:46 
GeneralRe: What are we doing to our kids? Pin
jschell17-Feb-23 10:43
jschell17-Feb-23 10:43 
GeneralRe: What are we doing to our kids? Pin
Cpichols20-Feb-23 1:26
Cpichols20-Feb-23 1:26 
GeneralThe Exception to the Exception Pin
nepdev16-Feb-23 4:34
nepdev16-Feb-23 4:34 
I am tired of tutorials and senior programmers which "explain" that exceptions should never be handled in lower level code.

Here is my example to end all examples why you do need to catch exceptions sometimes in low level code:

We have a component for importing millions of records of data from a delimited text file, process it and store it in cleaned-up form in a database.
Now, data in delimited text files is "quite" clean but very occasionally it is not, and we want the import to stop and indicate WHICH column. So we can fix the import data, or the thing which generates it.

Let's say that's a date column and we have Convert.ToDateTime() and there are 10 date columns in that structure - it will throw an exception allright which bubbles up but will be the unhelpful
String '184' was not recognized as a valid DateTime
.

So - catch the exception, add row and column info and then re-throw. Really, anyone who sees this as wrong must be working with mickey-mouse applications where you never have to sift through millions of records to find the one datum which is wrong. Isn't it?

Out of this "purity" of exception handling we get abominations like the SQL Server error message "String or binary data would be truncated." (I know it's finally handled as of SQL Server 2019, but it's been around for decades.)
GeneralRe: The Exception to the Exception Pin
OriginalGriff16-Feb-23 5:05
mveOriginalGriff16-Feb-23 5:05 
GeneralRe: The Exception to the Exception Pin
Marc Clifton16-Feb-23 5:36
mvaMarc Clifton16-Feb-23 5:36 
GeneralRe: The Exception to the Exception Pin
PIEBALDconsult16-Feb-23 6:33
mvePIEBALDconsult16-Feb-23 6:33 
GeneralRe: The Exception to the Exception Pin
Peter Kelley 202117-Feb-23 2:06
Peter Kelley 202117-Feb-23 2:06 
GeneralRe: The Exception to the Exception Pin
jschell17-Feb-23 10:02
jschell17-Feb-23 10:02 
GeneralRe: The Exception to the Exception Pin
jmaida16-Feb-23 13:41
jmaida16-Feb-23 13:41 
GeneralRe: The Exception to the Exception Pin
PIEBALDconsult16-Feb-23 6:31
mvePIEBALDconsult16-Feb-23 6:31 
GeneralRe: The Exception to the Exception Pin
Peter Adam16-Feb-23 23:42
professionalPeter Adam16-Feb-23 23:42 
GeneralRe: The Exception to the Exception Pin
jschell16-Feb-23 7:26
jschell16-Feb-23 7:26 
GeneralRe: The Exception to the Exception Pin
Gerry Schmitz16-Feb-23 8:02
mveGerry Schmitz16-Feb-23 8:02 
GeneralRe: The Exception to the Exception Pin
BillWoodruff16-Feb-23 19:43
professionalBillWoodruff16-Feb-23 19:43 
GeneralRe: The Exception to the Exception Pin
maze316-Feb-23 23:28
professionalmaze316-Feb-23 23:28 
GeneralRe: The Exception to the Exception Pin
Davyd McColl17-Feb-23 6:51
Davyd McColl17-Feb-23 6:51 
GeneralRe: The Exception to the Exception Pin
englebart18-Feb-23 4:05
professionalenglebart18-Feb-23 4:05 
GeneralRe: The Exception to the Exception Pin
Cpichols20-Feb-23 1:33
Cpichols20-Feb-23 1:33 
GeneralRe: The Exception to the Exception Pin
atverweij20-Feb-23 2:44
atverweij20-Feb-23 2:44 
GeneralWSO CCC OTD 2023-02-16 Pin
OriginalGriff15-Feb-23 21:40
mveOriginalGriff15-Feb-23 21:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.