|
From: <fab...@us...> - 2009-05-24 05:24:08
|
Revision: 4372
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4372&view=rev
Author: fabiomaulo
Date: 2009-05-24 05:24:03 +0000 (Sun, 24 May 2009)
Log Message:
-----------
Improved ISQLExceptionConverter for future extensions
Modified Paths:
--------------
trunk/nhibernate/releasenotes.txt
trunk/nhibernate/src/NHibernate/ADOException.cs
trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs
trunk/nhibernate/src/NHibernate/Exceptions/ADOConnectionException.cs
trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs
trunk/nhibernate/src/NHibernate/Exceptions/ConstraintViolationException.cs
trunk/nhibernate/src/NHibernate/Exceptions/DataException.cs
trunk/nhibernate/src/NHibernate/Exceptions/GenericADOException.cs
trunk/nhibernate/src/NHibernate/Exceptions/ISQLExceptionConverter.cs
trunk/nhibernate/src/NHibernate/Exceptions/LockAcquisitionException.cs
trunk/nhibernate/src/NHibernate/Exceptions/SQLExceptionConverterFactory.cs
trunk/nhibernate/src/NHibernate/Exceptions/SQLGrammarException.cs
trunk/nhibernate/src/NHibernate/Exceptions/SQLStateConverter.cs
trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs
trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/MSSQLExceptionConverterExample.cs
trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/OracleClientExceptionConverterExample.cs
trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs
trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs
Modified: trunk/nhibernate/releasenotes.txt
===================================================================
--- trunk/nhibernate/releasenotes.txt 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/releasenotes.txt 2009-05-24 05:24:03 UTC (rev 4372)
@@ -29,6 +29,8 @@
* CriteriaUtil is gone. NHibernate.Transform.Transformers now returns predefined IResultTransformer.
* ISessionFactory.Settings is gone (moved to ISessionFactoryImplementor.Settings)
* Obsolete ORACLE dialects was removed (new implementations are available)
+ * ISQLExceptionConverter was changed in order to have more flexibility about information available for the conversion and followed management.
+ * ADOException now use string instead SqlString
Build 2.1.0.Alpha2 (rev4167)
========================
Modified: trunk/nhibernate/src/NHibernate/ADOException.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/ADOException.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/ADOException.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,7 +1,6 @@
using System;
using System.Runtime.Serialization;
using System.Security.Permissions;
-using NHibernate.SqlCommand;
namespace NHibernate
{
@@ -16,7 +15,7 @@
[Serializable]
public class ADOException : HibernateException
{
- private readonly SqlString sql;
+ private readonly string sql;
/// <summary>
/// Initializes a new instance of the <see cref="ADOException"/> class.
@@ -31,7 +30,7 @@
{
}
- public ADOException(string message, Exception innerException, SqlString sql)
+ public ADOException(string message, Exception innerException, string sql)
: base(message + "[SQL: " + sql + "]", innerException)
{
this.sql = sql;
@@ -49,7 +48,7 @@
/// </param>
protected ADOException(SerializationInfo info, StreamingContext context) : base(info, context)
{
- this.sql = (SqlString) info.GetValue("sql", typeof(SqlString));
+ this.sql = (string) info.GetValue("sql", typeof(string));
}
[SecurityPermission(SecurityAction.LinkDemand,
@@ -60,7 +59,7 @@
info.AddValue("sql", sql);
}
- public SqlString SqlString
+ public string SqlString
{
get { return sql; }
}
Modified: trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -501,7 +501,7 @@
get { return commandsToClose.Count > 0 || readersToClose.Count > 0; }
}
- protected ADOException Convert(Exception sqlException, string message)
+ protected Exception Convert(Exception sqlException, string message)
{
return ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, sqlException, message);
}
Modified: trunk/nhibernate/src/NHibernate/Exceptions/ADOConnectionException.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/ADOConnectionException.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/ADOConnectionException.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,6 +1,5 @@
using System;
using System.Runtime.Serialization;
-using NHibernate.SqlCommand;
namespace NHibernate.Exceptions
{
@@ -12,7 +11,7 @@
public class ADOConnectionException : ADOException
{
public ADOConnectionException(SerializationInfo info, StreamingContext context) : base(info, context) {}
- public ADOConnectionException(string message, Exception innerException, SqlString sql) : base(message, innerException, sql) {}
+ public ADOConnectionException(string message, Exception innerException, string sql) : base(message, innerException, sql) {}
public ADOConnectionException(string message, Exception innerException) : base(message, innerException) {}
}
}
Modified: trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -21,12 +21,13 @@
/// <param name="message">An optional error message.</param>
/// <param name="sql">The SQL executed.</param>
/// <returns> The converted <see cref="ADOException"/>.</returns>
- public static ADOException Convert(ISQLExceptionConverter converter, Exception sqlException, string message,
+ public static Exception Convert(ISQLExceptionConverter converter, Exception sqlException, string message,
SqlString sql)
{
sql = TryGetActualSqlQuery(sqlException, sql);
ADOExceptionReporter.LogExceptions(sqlException, ExtendMessage(message, sql, null, null));
- return converter.Convert(sqlException, message, sql);
+ return
+ converter.Convert(new AdoExceptionContextInfo {SqlException = sqlException, Message = message, Sql = sql.ToString()});
}
/// <summary>
@@ -37,7 +38,7 @@
/// <param name="sqlException">The exception to convert.</param>
/// <param name="message">An optional error message.</param>
/// <returns> The converted <see cref="ADOException"/>.</returns>
- public static ADOException Convert(ISQLExceptionConverter converter, Exception sqlException, string message)
+ public static Exception Convert(ISQLExceptionConverter converter, Exception sqlException, string message)
{
var sql = new SqlString(SQLNotAvailable);
sql = TryGetActualSqlQuery(sqlException, sql);
@@ -50,7 +51,7 @@
sql = TryGetActualSqlQuery(sqle, sql);
string extendMessage = ExtendMessage(message, sql, parameterValues, namedParameters);
ADOExceptionReporter.LogExceptions(sqle, extendMessage);
- return new ADOException(extendMessage, sqle, sql);
+ return new ADOException(extendMessage, sqle, sql.ToString());
}
/// <summary> For the given <see cref="Exception"/>, locates the <see cref="System.Data.Common.DbException"/>. </summary>
Modified: trunk/nhibernate/src/NHibernate/Exceptions/ConstraintViolationException.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/ConstraintViolationException.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/ConstraintViolationException.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,6 +1,5 @@
using System;
using System.Runtime.Serialization;
-using NHibernate.SqlCommand;
namespace NHibernate.Exceptions
{
@@ -15,7 +14,7 @@
public ConstraintViolationException(SerializationInfo info, StreamingContext context)
: base(info, context) {}
- public ConstraintViolationException(string message, Exception innerException, SqlString sql, string constraintName)
+ public ConstraintViolationException(string message, Exception innerException, string sql, string constraintName)
: base(message, innerException, sql)
{
this.constraintName = constraintName;
Modified: trunk/nhibernate/src/NHibernate/Exceptions/DataException.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/DataException.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/DataException.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,6 +1,5 @@
using System;
using System.Runtime.Serialization;
-using NHibernate.SqlCommand;
namespace NHibernate.Exceptions
{
@@ -13,7 +12,7 @@
public class DataException : ADOException
{
public DataException(SerializationInfo info, StreamingContext context) : base(info, context) {}
- public DataException(string message, Exception innerException, SqlString sql) : base(message, innerException, sql) {}
+ public DataException(string message, Exception innerException, string sql) : base(message, innerException, sql) {}
public DataException(string message, Exception innerException) : base(message, innerException) {}
}
}
Modified: trunk/nhibernate/src/NHibernate/Exceptions/GenericADOException.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/GenericADOException.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/GenericADOException.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -8,7 +8,7 @@
public class GenericADOException : ADOException
{
public GenericADOException(SerializationInfo info, StreamingContext context) : base(info, context) { }
- public GenericADOException(string message, Exception innerException, SqlString sql) : base(message, innerException, sql) { }
+ public GenericADOException(string message, Exception innerException, string sql) : base(message, innerException, sql) { }
public GenericADOException(string message, Exception innerException) : base(message, innerException) { }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Exceptions/ISQLExceptionConverter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/ISQLExceptionConverter.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/ISQLExceptionConverter.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,8 +1,32 @@
using System;
-using NHibernate.SqlCommand;
namespace NHibernate.Exceptions
{
+ /// <summary>
+ /// Collect data of an <see cref="ADOException"/> to be converted.
+ /// </summary>
+ public class AdoExceptionContextInfo
+ {
+ // This class was introduced, in NH, to allow less intrusive possible extensions
+ // of information given to the ISQLExceptionConverter
+ // (extensions of a class instead succesive changes of a method)
+
+ /// <summary>
+ /// The <see cref="System.Data.Common.DbException"/> to be converted.
+ /// </summary>
+ public Exception SqlException { get; set; }
+
+ /// <summary>
+ /// An optional error message.
+ /// </summary>
+ public string Message { get; set; }
+
+ /// <summary>
+ /// The SQL that generate the exception
+ /// </summary>
+ public string Sql { get; set; }
+ }
+
/// <summary>
/// Defines a contract for implementations that know how to convert a <see cref="System.Data.Common.DbException"/>
/// into NHibernate's <see cref="ADOException"/> hierarchy.
@@ -20,12 +44,10 @@
public interface ISQLExceptionConverter
{
/// <summary>
- /// Convert the given <see cref="System.Data.Common.DbException"/> into NHibernate's ADOException hierarchy.
+ /// Convert the given <see cref="System.Data.Common.DbException"/> into custom Exception.
/// </summary>
- /// <param name="sqlException">The <see cref="System.Data.Common.DbException"/> to be converted. </param>
- /// <param name="message"> An optional error message. </param>
- /// <param name="sql">The SQL that generate the exception</param>
- /// <returns> The resulting ADOException. </returns>
- ADOException Convert(Exception sqlException, string message, SqlString sql);
+ /// <param name="adoExceptionContextInfo">Available information during exception throw.</param>
+ /// <returns> The resulting Exception to throw. </returns>
+ Exception Convert(AdoExceptionContextInfo adoExceptionContextInfo);
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Exceptions/LockAcquisitionException.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/LockAcquisitionException.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/LockAcquisitionException.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,6 +1,5 @@
using System;
using System.Runtime.Serialization;
-using NHibernate.SqlCommand;
namespace NHibernate.Exceptions
{
@@ -12,7 +11,7 @@
public class LockAcquisitionException : ADOException
{
public LockAcquisitionException(SerializationInfo info, StreamingContext context) : base(info, context) {}
- public LockAcquisitionException(string message, Exception innerException, SqlString sql) : base(message, innerException, sql) {}
+ public LockAcquisitionException(string message, Exception innerException, string sql) : base(message, innerException, sql) {}
public LockAcquisitionException(string message, Exception innerException) : base(message, innerException) {}
}
}
Modified: trunk/nhibernate/src/NHibernate/Exceptions/SQLExceptionConverterFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/SQLExceptionConverterFactory.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/SQLExceptionConverterFactory.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Reflection;
using log4net;
-using NHibernate.SqlCommand;
using NHibernate.Util;
namespace NHibernate.Exceptions
@@ -16,9 +15,9 @@
{
#region ISQLExceptionConverter Members
- public ADOException Convert(Exception sqlException, string message, SqlString sql)
+ public Exception Convert(AdoExceptionContextInfo exceptionContextInfo)
{
- throw new GenericADOException(message, sqlException, sql);
+ throw new GenericADOException(exceptionContextInfo.Message, exceptionContextInfo.SqlException, exceptionContextInfo.Sql);
}
#endregion
Modified: trunk/nhibernate/src/NHibernate/Exceptions/SQLGrammarException.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/SQLGrammarException.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/SQLGrammarException.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,6 +1,5 @@
using System;
using System.Runtime.Serialization;
-using NHibernate.SqlCommand;
namespace NHibernate.Exceptions
{
@@ -12,7 +11,7 @@
public class SQLGrammarException : ADOException
{
public SQLGrammarException(SerializationInfo info, StreamingContext context) : base(info, context) {}
- public SQLGrammarException(string message, Exception innerException, SqlString sql) : base(message, innerException, sql) {}
+ public SQLGrammarException(string message, Exception innerException, string sql) : base(message, innerException, sql) {}
public SQLGrammarException(string message, Exception innerException) : base(message, innerException) {}
}
}
Modified: trunk/nhibernate/src/NHibernate/Exceptions/SQLStateConverter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/SQLStateConverter.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Exceptions/SQLStateConverter.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,5 +1,4 @@
using System;
-using NHibernate.SqlCommand;
namespace NHibernate.Exceptions
{
@@ -19,7 +18,7 @@
#region ISQLExceptionConverter Members
- public ADOException Convert(Exception sqlException, string message, SqlString sql)
+ public Exception Convert(AdoExceptionContextInfo exceptionInfo)
{
/*
* So far I know we don't have something similar to "X/Open-compliant SQLState" in .NET
@@ -27,7 +26,7 @@
* and its own IViolatedConstraintNameExtracter if needed.
* The System.Data.Common.DbException, of .NET2.0, don't give us something applicable to all dialects.
*/
- return HandledNonSpecificException(sqlException, message, sql);
+ return HandledNonSpecificException(exceptionInfo.SqlException, exceptionInfo.Message, exceptionInfo.Sql);
}
#endregion
@@ -37,7 +36,7 @@
/// <param name="message">An optional message </param>
/// <param name="sql">Optionally, the sql being performed when the exception occurred. </param>
/// <returns> The converted exception; should <b>never</b> be null. </returns>
- public static ADOException HandledNonSpecificException(Exception sqlException, string message, SqlString sql)
+ public static ADOException HandledNonSpecificException(Exception sqlException, string message, string sql)
{
return new GenericADOException(message, sqlException, sql);
}
Modified: trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -2,7 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Data;
-using System.Transactions;
using NHibernate.AdoNet;
using NHibernate.Collection;
using NHibernate.Engine;
@@ -285,7 +284,7 @@
}
}
- protected ADOException Convert(Exception sqlException, string message)
+ protected Exception Convert(Exception sqlException, string message)
{
using (new SessionIdLoggingContext(SessionId))
{
Modified: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/MSSQLExceptionConverterExample.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/MSSQLExceptionConverterExample.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/MSSQLExceptionConverterExample.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,7 +1,6 @@
using System;
using System.Data.SqlClient;
using NHibernate.Exceptions;
-using NHibernate.SqlCommand;
namespace NHibernate.Test.ExceptionsTest
{
@@ -11,17 +10,17 @@
{
#region ISQLExceptionConverter Members
- public ADOException Convert(Exception sqlException, string message, SqlString sql)
+ public Exception Convert(AdoExceptionContextInfo exInfo)
{
- SqlException sqle = ADOExceptionHelper.ExtractDbException(sqlException) as SqlException;
+ SqlException sqle = ADOExceptionHelper.ExtractDbException(exInfo.SqlException) as SqlException;
if(sqle != null)
{
if (sqle.Number == 547)
- return new ConstraintViolationException(message, sqle.InnerException, sql, null);
+ return new ConstraintViolationException(exInfo.Message, sqle.InnerException, exInfo.Sql, null);
if (sqle.Number == 208)
- return new SQLGrammarException(message, sqle.InnerException, sql);
+ return new SQLGrammarException(exInfo.Message, sqle.InnerException, exInfo.Sql);
}
- return SQLStateConverter.HandledNonSpecificException(sqlException, message, sql);
+ return SQLStateConverter.HandledNonSpecificException(exInfo.SqlException, exInfo.Message, exInfo.Sql);
}
#endregion
Modified: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/OracleClientExceptionConverterExample.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/OracleClientExceptionConverterExample.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/OracleClientExceptionConverterExample.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,7 +1,6 @@
using System;
using System.Data.OracleClient;
using NHibernate.Exceptions;
-using NHibernate.SqlCommand;
namespace NHibernate.Test.ExceptionsTest
{
@@ -9,21 +8,21 @@
{
#region ISQLExceptionConverter Members
- public ADOException Convert(Exception sqlException, string message, SqlString sql)
+ public Exception Convert(AdoExceptionContextInfo exInfo)
{
- var sqle = ADOExceptionHelper.ExtractDbException(sqlException) as OracleException;
+ var sqle = ADOExceptionHelper.ExtractDbException(exInfo.SqlException) as OracleException;
if (sqle != null)
{
if (sqle.Code == 1036)
{
- return new ConstraintViolationException(message, sqle.InnerException, sql, null);
+ return new ConstraintViolationException(exInfo.Message, sqle.InnerException, exInfo.Sql, null);
}
if (sqle.Code == 942)
{
- return new SQLGrammarException(message, sqle.InnerException, sql);
+ return new SQLGrammarException(exInfo.Message, sqle.InnerException, exInfo.Sql);
}
}
- return SQLStateConverter.HandledNonSpecificException(sqlException, message, sql);
+ return SQLStateConverter.HandledNonSpecificException(exInfo.SqlException, exInfo.Message, exInfo.Sql);
}
#endregion
Modified: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -1,30 +1,28 @@
using System;
using System.Data.Common;
-using NHibernate;
using NHibernate.Exceptions;
-using NHibernate.SqlCommand;
public class PostgresExceptionConverterExample : ISQLExceptionConverter
{
#region ISQLExceptionConverter Members
- public ADOException Convert(Exception sqlException, string message, SqlString sql)
+ public Exception Convert(AdoExceptionContextInfo exInfo)
{
- var sqle = ADOExceptionHelper.ExtractDbException(sqlException) as DbException;
+ var sqle = ADOExceptionHelper.ExtractDbException(exInfo.SqlException) as DbException;
if (sqle != null)
{
string code = (string) sqle.GetType().GetProperty("Code").GetValue(sqle, null);
if (code == "23503")
{
- return new ConstraintViolationException(message, sqle.InnerException, sql, null);
+ return new ConstraintViolationException(exInfo.Message, sqle.InnerException, exInfo.Sql, null);
}
if (code == "42P01")
{
- return new SQLGrammarException(message, sqle.InnerException, sql);
+ return new SQLGrammarException(exInfo.Message, sqle.InnerException, exInfo.Sql);
}
}
- return SQLStateConverter.HandledNonSpecificException(sqlException, message, sql);
+ return SQLStateConverter.HandledNonSpecificException(exInfo.SqlException, exInfo.Message, exInfo.Sql);
}
#endregion
Modified: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs 2009-05-23 23:18:48 UTC (rev 4371)
+++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs 2009-05-24 05:24:03 UTC (rev 4372)
@@ -79,7 +79,7 @@
catch (Exception sqle)
{
ADOExceptionReporter.LogExceptions(sqle, "Just output!!!!");
- ADOException adoException = converter.Convert(sqle, null, null);
+ Exception adoException = converter.Convert(new AdoExceptionContextInfo{SqlException = sqle});
Assert.AreEqual(typeof(ConstraintViolationException), adoException.GetType(),
"Bad conversion [" + sqle.Message + "]");
ConstraintViolationException ex = (ConstraintViolationException)adoException;
@@ -126,7 +126,9 @@
}
catch (Exception sqle)
{
- Assert.AreEqual(typeof(SQLGrammarException), converter.Convert(sqle, null, null).GetType(), "Bad conversion [" + sqle.Message + "]");
+ Assert.AreEqual(typeof (SQLGrammarException),
+ converter.Convert(new AdoExceptionContextInfo {SqlException = sqle}).GetType(),
+ "Bad conversion [" + sqle.Message + "]");
}
finally
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|