From: <fab...@us...> - 2009-05-24 06:25:09
|
Revision: 4374 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4374&view=rev Author: fabiomaulo Date: 2009-05-24 06:24:56 +0000 (Sun, 24 May 2009) Log Message: ----------- Improved the context of each AdoException. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs Modified: trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2009-05-24 06:13:38 UTC (rev 4373) +++ trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2009-05-24 06:24:56 UTC (rev 4374) @@ -1269,7 +1269,16 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, "could not initialize lazy properties: " + MessageHelper.InfoString(this, id, Factory), SQLLazySelectString); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = + "could not initialize lazy properties: " + MessageHelper.InfoString(this, id, Factory), + Sql = SQLLazySelectString.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } } @@ -1432,7 +1441,15 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, "could not retrieve snapshot: " + MessageHelper.InfoString(this, id, Factory), SQLSnapshotSelectString); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = "could not retrieve snapshot: " + MessageHelper.InfoString(this, id, Factory), + Sql = SQLSnapshotSelectString.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } } @@ -1608,9 +1625,15 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, - "could not retrieve version: " + MessageHelper.InfoString(this, id, Factory), - VersionSelectString); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = "could not retrieve version: " + MessageHelper.InfoString(this, id, Factory), + Sql = VersionSelectString.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } return nextVersion; } @@ -1664,9 +1687,15 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, - "could not retrieve version: " + MessageHelper.InfoString(this, id, Factory), - VersionSelectString); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = "could not retrieve version: " + MessageHelper.InfoString(this, id, Factory), + Sql = VersionSelectString.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } } @@ -2600,8 +2629,15 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, - "could not insert: " + MessageHelper.InfoString(this), sql.Text); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = "could not insert: " + MessageHelper.InfoString(this), + Sql = sql.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } } @@ -2845,7 +2881,15 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, "could not delete: " + MessageHelper.InfoString(this, id, Factory), sql.Text); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = "could not delete: " + MessageHelper.InfoString(this, id, Factory), + Sql = sql.Text.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } } @@ -3892,8 +3936,15 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, "unable to select generated column values", - selectionSQL); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = "unable to select generated column values", + Sql = selectionSQL.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } } @@ -3972,7 +4023,15 @@ } catch (DbException sqle) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqle, "could not retrieve snapshot: " + MessageHelper.InfoString(this, id, Factory), sql); + var exceptionContext = new AdoExceptionContextInfo + { + SqlException = sqle, + Message = "could not retrieve snapshot: " + MessageHelper.InfoString(this, id, Factory), + Sql = sql.ToString(), + EntityName = EntityName, + EntityId = id + }; + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, exceptionContext); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |