Exception Tolerance
-
I have an Export Engine that uses an XML export definition to create mainly CSV files from a database. I would like to build in exception tolerance at the field and line level, so that when testing a new definition or a change to a definition, I just log all exceptions, and deal with them as a batch after a test run, rather than have the run abort at each new exception found. Exceptions that should be tolerated are invalid field names, null values etc. Are there any established patterns for implementing this?
Pits fall into Chuck Norris.
-
I have an Export Engine that uses an XML export definition to create mainly CSV files from a database. I would like to build in exception tolerance at the field and line level, so that when testing a new definition or a change to a definition, I just log all exceptions, and deal with them as a batch after a test run, rather than have the run abort at each new exception found. Exceptions that should be tolerated are invalid field names, null values etc. Are there any established patterns for implementing this?
Pits fall into Chuck Norris.
I would use a validation engine for this, and just build up a list of validation failures. The beauty of a validation engine is that you can add rules iteratively and the engine should be able to cope. I wrote part of one a while back that you are more than welcome to take and add your rules to. Send me a mail for it.
Deja View - the feeling that you've seen this post before.
-
I would use a validation engine for this, and just build up a list of validation failures. The beauty of a validation engine is that you can add rules iteratively and the engine should be able to cope. I wrote part of one a while back that you are more than welcome to take and add your rules to. Send me a mail for it.
Deja View - the feeling that you've seen this post before.
Thanks Pete, I'd love to have a look at your engine, but what are you suggesting I validate? The definition, i.e. does the query execute, do all the output fields map correctly to input fields etc? Or validate every row of input data against the output schema?
Pits fall into Chuck Norris.
-
Thanks Pete, I'd love to have a look at your engine, but what are you suggesting I validate? The definition, i.e. does the query execute, do all the output fields map correctly to input fields etc? Or validate every row of input data against the output schema?
Pits fall into Chuck Norris.
It's up to you what you validate, but you could do things like validate that mandatory fields aren't null, that field types don't conflict with field values - that type of thing.
Deja View - the feeling that you've seen this post before.
-
It's up to you what you validate, but you could do things like validate that mandatory fields aren't null, that field types don't conflict with field values - that type of thing.
Deja View - the feeling that you've seen this post before.
I've decided, in light of this being a financial application, any exception handling or avoidance, is not worth the risk, so I'm revising my strategy to only possibly increase the number of exceptions thrown. Applying a validation engine here would be overkill, as most operations generate exceptions for fault conditions, e.g. invalid field names, but I'd still like to see your engine and maybe use it as inspiration elsewhere.
-
I've decided, in light of this being a financial application, any exception handling or avoidance, is not worth the risk, so I'm revising my strategy to only possibly increase the number of exceptions thrown. Applying a validation engine here would be overkill, as most operations generate exceptions for fault conditions, e.g. invalid field names, but I'd still like to see your engine and maybe use it as inspiration elsewhere.
Brady - send me an email (through the email link here) so that I can get an address to send the project to.
Deja View - the feeling that you've seen this post before.
-
I have an Export Engine that uses an XML export definition to create mainly CSV files from a database. I would like to build in exception tolerance at the field and line level, so that when testing a new definition or a change to a definition, I just log all exceptions, and deal with them as a batch after a test run, rather than have the run abort at each new exception found. Exceptions that should be tolerated are invalid field names, null values etc. Are there any established patterns for implementing this?
Pits fall into Chuck Norris.
Maybe have it raise events rather than throw exceptions, perhaps when in a "testing" mode or something.
try
{
// Do something
}
catch ( System.Exception err )
{if Testing
OnExceptionCaught ( err ) ;
else
throw ( err ) ; // Hopefully with additional info, of course
endif
}