Skip to content

Commit 5934be4

Browse files
author
Sergey Koshcheyev
committed
Added Convert method overload with 3 parameters (from H3)
SVN: trunk@2004
1 parent a84b581 commit 5934be4

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/NHibernate/ADOException.cs

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
2-
using System.Data;
32
using System.Runtime.Serialization;
4-
using log4net;
3+
4+
using NHibernate.SqlCommand;
55

66
namespace NHibernate
77
{
@@ -16,6 +16,8 @@ namespace NHibernate
1616
[ Serializable ]
1717
public class ADOException : HibernateException
1818
{
19+
private SqlString sql;
20+
1921
/// <summary>
2022
/// Initializes a new instance of the <see cref="ADOException"/> class.
2123
/// </summary>
@@ -29,6 +31,12 @@ public ADOException( string message, Exception innerException ) : base( message,
2931
{
3032
}
3133

34+
public ADOException( string message, Exception innerException, SqlString sql )
35+
: base( message, innerException )
36+
{
37+
this.sql = sql;
38+
}
39+
3240
/// <summary>
3341
/// Initializes a new instance of the <see cref="ADOException"/> class.
3442
/// </summary>
@@ -41,7 +49,18 @@ public ADOException( string message, Exception innerException ) : base( message,
4149
/// </param>
4250
protected ADOException( SerializationInfo info, StreamingContext context ) : base( info, context )
4351
{
52+
this.sql = ( SqlString ) info.GetValue( "sql", typeof( SqlString ) );
4453
}
4554

55+
public override void GetObjectData(SerializationInfo info, StreamingContext context)
56+
{
57+
base.GetObjectData( info, context );
58+
info.AddValue( "sql", sql );
59+
}
60+
61+
public SqlString SqlString
62+
{
63+
get { return sql; }
64+
}
4665
}
4766
}

src/NHibernate/Exceptions/ADOExceptionHelper.cs

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22

3+
using NHibernate.SqlCommand;
34
using NHibernate.Util;
45

56
namespace NHibernate.Exceptions
@@ -24,5 +25,12 @@ public static ADOException Convert( /*ISQLExceptionConverter converter,*/ System
2425
// return converter.Convert( sqlException, message );
2526
return new ADOException( message, sqlException );
2627
}
28+
29+
public static ADOException Convert( System.Exception sqlException, string message, SqlString sql )
30+
{
31+
ADOExceptionReporter.LogExceptions( sqlException, message + " [" + sql + "]" );
32+
return new ADOException( message, sqlException, sql );
33+
34+
}
2735
}
2836
}

0 commit comments

Comments
 (0)