Exception handling and metaling are what I see as misunderstood all the time, by most of the developers I worked with.
- .
- , "" .
- ( ) , NullReferenceException.
- , .
- , , catch, wrap throw.
try/catch/() , ...
catch , , . - . //.
, , InnerException.
. , DataAccessException , , InnerException. , , , , , DataAccessException - .
DataAccessException , SqlDataAccessException SecurityDataAccessException.
, , , , - , . , , try/ .
, , try/catch , , .
: " , , ?" ExecuteNonSql, API/ , . XML- , DLL, XML.
, . /- , , , :)
Cwalina Abrams. , , , API Microsoft ( ).
. .
" { }. { }. { }. . { | }."
, :
...
catch(FileNotFoundException fnfe)
{
string m = String.Format("Cannot save changes. A FileNotFoundException occurred. Check the path '{0}' is valid, that your network is up, and any removable media is available. Please see inner exception.", path);
_log.Error(m, fnfe);
throw new StorageLifecycleException(m, fnfe);
}