Re: [snapdal-devel] Sql and parameters in the exception message
Status: Beta
Brought to you by:
panmanphil
From: Philip N. <pan...@ya...> - 2004-04-29 02:33:00
|
--- "Chad M. Gross" <cg...@ne...> wrote: > I would recommend keeping any important info out of the Message property. > And certainly, you would always want to include the actual exception as the > inner. Any important info, such as CC# in the current statment's > parameters, can be exposed through a collection off of the new typed > exception. As you mentioned, it would then be the developers choice to log > the exception as they choose either "dumping" the parameters or not. I do like this approach. Would it make sense to have a Formatted Message property that makes it easier to just log a complete message? > Some > things I can think of that may be a good idea with the DAL exceptions would > be obviously have some SnapDALDataException base class that has props like > StatementName and Parameters. Then having exceptions like > SnapDALUniqueViolationException (caused by constraint or unique index and > try to extract the constraint/index name), SnapDALDeadlockException, > SnapDALTimeoutException, SnapDALConfigFileNotFound, and any other common > data provider errors or meaningful "throw new Exception()" calls that are in > SnapDal that should be a typed exception. One of the things I noticed while diving into this part of ADO.Net was that exceptions aren't defined as part of the framework. If you were to truly have generic data access, which SnapDAL now makes more possible with it's cache directory structure, you would still be stuck with the lowest common denominator of Exception, or in our case DataFactoryException. With a reasonable hierarchy of typed exceptions for the most common sql errors, timeout, deadlock, constraint, you could handle these in a consistent way. There would be a burden to add new providers because for each we would have to figure what native exceptions matched these generic types, but it wouldn't be so bad. I would like to do a release before getting started on this, because I would like to get more feedback on the mock object implementation and see if others will find it useful. ===== Philip - http://blogs.xcskiwinn.org/panmanphil "There's a difference between righteous anger and just being crabby" - Barbara |